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 [ class base { public: virtual base *GetPtr( void ) { return this; } }; ],
95 [ class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } }; ],
96 [AC_DEFINE([HAVE_COVARIANT_RETURNS], [1], [Define to 1 if C++ compiler supports covariant virtual methods.])])
98 # log4shib settings (favor this version over the log4cpp code)
99 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
100 AC_ARG_WITH(log4shib,
101 AC_HELP_STRING([--with-log4shib=PATH], [where log4shib-config is installed]),
103 LOG4SHIB_CONFIG="${with_log4shib}"
104 if ! test -f "${LOG4SHIB_CONFIG}" ; then
105 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
108 if test -f "${LOG4SHIB_CONFIG}"; then
109 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
110 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
111 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
113 [#include <log4shib/Category.hh>
114 #include <log4shib/CategoryStream.hh>],
115 [log4shib::Category::getInstance("foo").errorStream() << log4shib::eol],
116 [AC_DEFINE([XMLTOOLING_LOG4SHIB], [1], [Define to 1 if log4shib library is used.])],
117 [AC_MSG_ERROR([unable to link with log4shib])])
119 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
120 AC_MSG_WARN([will look for original log4cpp library])
123 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
125 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]),
127 LOG4CPP_CONFIG="${with_log4cpp}"
128 if ! test -f "${LOG4CPP_CONFIG}" ; then
129 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
132 if test -f "${LOG4CPP_CONFIG}"; then
133 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
134 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
135 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
136 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
138 [#include <log4cpp/Category.hh>
139 #include <log4cpp/CategoryStream.hh>],
140 [log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol],
141 [AC_DEFINE([XMLTOOLING_LOG4CPP], [1], [Define to 1 if log4cpp library is used.])],
142 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
144 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
150 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
151 [if test x_$with_xerces != x_/usr; then
152 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
153 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
155 LIBS="-lxerces-c $LIBS"
156 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
157 AC_MSG_CHECKING([Xerces version])
159 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
160 [#if _XERCES_VERSION != 20600
163 #error cannot use version 2.6.0
166 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
168 [#include <xercesc/util/PlatformUtils.hpp>],
169 [xercesc::XMLPlatformUtils::Initialize()],
170 [AC_DEFINE([HAVE_LIBXERCESC], [1], [Define to 1 if Xerces-C library was found])],
171 [AC_MSG_ERROR([unable to link with Xerces])])
173 AC_MSG_CHECKING([whether Xerces is 64-bit clean])
174 AC_TRY_COMPILE([#include <xercesc/framework/MemBufInputSource.hpp>],
175 [using namespace XERCES_CPP_NAMESPACE;
178 [AC_MSG_RESULT([yes])]
179 [AC_DEFINE([XMLTOOLING_XERCESC_64BITSAFE], [1], [Define to 1 if Xerces has a 64-bit-safe API.])],
180 [AC_MSG_RESULT([no])])
182 AC_MSG_CHECKING([whether Xerces BinInputStream requires getContentType])
183 AC_TRY_COMPILE([#include <xercesc/util/BinMemInputStream.hpp>],
184 [using namespace XERCES_CPP_NAMESPACE;
186 BinMemInputStream in(buf,1024);
189 [AC_MSG_RESULT([yes])]
190 [AC_DEFINE([XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE], [1], [Define to 1 if Xerces InputStream class requires getContentType.])],
191 [AC_MSG_RESULT([no])])
193 AC_MSG_CHECKING([whether Xerces DOMLS API is compliant])
194 AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
195 [using namespace XERCES_CPP_NAMESPACE;
196 DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(NULL);
197 DOMLSSerializer *ls = ((DOMImplementationLS*)impl)->createLSSerializer();
199 [AC_MSG_RESULT([yes])]
200 [AC_DEFINE([XMLTOOLING_XERCESC_COMPLIANT_DOMLS], [1], [Define to 1 if Xerces supports a compliant DOMLS API.])],
201 [AC_MSG_RESULT([no])])
203 AC_MSG_CHECKING([whether Xerces has setIdAttribute(XMLCh*, bool)])
204 AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
205 [using namespace XERCES_CPP_NAMESPACE;
207 elt->setIdAttribute(NULL, false);
209 [AC_MSG_RESULT([yes])]
210 [AC_DEFINE([XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE], [1], [Define to 1 if Xerces DOM ID methods take extra parameter.])],
211 [AC_MSG_RESULT([no])])
213 # XML-Security settings
215 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
218 if test x_$with_xmlsec != x_no; then
220 # OpenSSL settings (need to do this first in case it's in a different spot from xmlsec)
222 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
223 [if test x_$with_openssl != x_/usr; then
224 SSLFLAGS="-I${with_openssl}/include"
225 SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
227 SSLLIBS="-lcrypto -lssl"
230 if test "x$SSLLIBS" = "x" ; then
231 AC_PATH_PROG(PKG_CONFIG, pkg-config)
232 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
233 if pkg-config openssl ; then
234 SSLLIBS="`$PKG_CONFIG --libs openssl`"
235 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
237 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
242 if test "x$SSLLIBS" = "x" ; then
243 SSLLIBS="-lcrypto -lssl"
246 AC_MSG_CHECKING(for OpenSSL cflags)
247 AC_MSG_RESULT($SSLFLAGS)
248 CPPFLAGS="$CPPFLAGS $SSLFLAGS"
249 AC_MSG_CHECKING(for OpenSSL libraries)
250 AC_MSG_RESULT($SSLLIBS)
251 XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
253 # save and append master libs
255 LIBS="$XMLSEC_LIBS $LIBS"
257 AC_CHECK_HEADER([openssl/pem.h],,
258 AC_MSG_ERROR([unable to find openssl header files]))
259 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
260 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
261 AC_MSG_ERROR([unable to link with openssl libraries]))
264 # restore master libs
267 if test x_$with_xmlsec != x_/usr; then
268 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
269 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
271 XMLSEC_LIBS="$XMLSEC_LIBS -lxml-security-c"
273 # save and append master libs
275 LIBS="$XMLSEC_LIBS $LIBS"
277 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
278 AC_MSG_CHECKING([XML-Security version])
280 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
281 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
284 #error need version 1.4.0 or later
287 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
289 [#include <xsec/utils/XSECPlatformUtils.hpp>],
290 [XSECPlatformUtils::Initialise()],,
291 [AC_MSG_ERROR([unable to link with XML-Security])])
292 AC_CHECK_TYPE([xsecsize_t],[AC_DEFINE([HAVE_XSECSIZE_T], [1], [Define to 1 if you have the 'xsecsize_t' type.])])
294 AC_MSG_CHECKING([whether XML-Security-C has multiple CRL support])
295 AC_TRY_COMPILE([#include <xsec/dsig/DSIGKeyInfoList.hpp>],
296 [DSIGKeyInfoList* klist; klist->getX509CRLListSize();],
297 [AC_MSG_RESULT([yes])]
298 [AC_DEFINE([XMLTOOLING_XMLSEC_MULTIPLECRL], [1], [Define to 1 if XML-Security-C handles multiple CRLs.])],
299 [AC_MSG_RESULT([no])])
301 AC_MSG_CHECKING([whether XML-Security-C exposes the signature algorithm URI])
302 AC_TRY_COMPILE([#include <xsec/dsig/DSIGSignature.hpp>],
303 [DSIGSignature* sig; sig->getAlgorithmURI();],
304 [AC_MSG_RESULT([yes])]
305 [AC_DEFINE([XMLTOOLING_XMLSEC_SIGALGORITHM], [1], [Define to 1 if XML-Security-C exposes the signature algorithm URI.])],
306 [AC_MSG_RESULT([no])])
308 # restore master libs
312 AC_PATH_PROG(CURL_CONFIG,curl-config)
314 AC_HELP_STRING([--with-curl=PATH], [where curl-config is installed]),
316 CURL_CONFIG="${with_curl}"
317 if ! test -f "${CURL_CONFIG}" ; then
318 CURL_CONFIG="${with_curl}/bin/curl-config"
321 if test -f "${CURL_CONFIG}" ; then
322 CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
323 XMLSEC_LIBS="`${CURL_CONFIG} --libs` $XMLSEC_LIBS"
325 AC_MSG_ERROR([curl-config not found, may need to use --with-curl option])
328 # save and append master libs
330 LIBS="$XMLSEC_LIBS $LIBS"
332 AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
333 AC_CHECK_LIB([curl],[curl_global_init],,AC_MSG_ERROR([unable to link with libcurl]))
334 AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
335 AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
336 [AC_MSG_RESULT(yes)],
337 [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
338 AC_CHECK_TYPE([curl_off_t],[AC_DEFINE([HAVE_CURL_OFF_T], [1], [Define to 1 if you have the 'curl_off_t' type.])])
340 # restore master libs
343 AC_SUBST(XMLSEC_LIBS)
345 AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
346 AC_DEFINE([XMLTOOLING_NO_XMLSEC], [1], [Define to 1 if you wish to disable XML-Security-dependent features.])
348 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
350 # Does the STL in use help or screw us?
353 [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
354 [AC_DEFINE([HAVE_GOOD_STL], [1],
355 [Define to 1 if you have an STL implementation that supports useful string specialization.])],
359 [std::iterator_traits<std::vector<int>::iterator>::value_type foo=0],
360 [AC_DEFINE([HAVE_ITERATOR_TRAITS], [1],
361 [Define to 1 if you have an STL implementation that supports std::iterator_traits.])],
364 # Check for unit test support
365 CXXTEST="/usr/bin/cxxtestgen.pl"
368 AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
369 [if test x_$with_cxxtest != x_/usr; then
370 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
371 CXXTESTFLAGS="-I${with_cxxtest}"
373 if ! test -f "${CXXTEST}"; then
374 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
378 AC_SUBST(CXXTESTFLAGS)
379 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
381 AX_CREATE_PKGCONFIG_INFO(,,[$XMLSEC_LIBS -lxmltooling],[OpenSAML XMLTooling-C library])
383 LIBTOOL="$LIBTOOL --silent"
385 # output packaging and makefiles
386 AC_CONFIG_FILES([xmltooling.spec pkginfo Portfile])
387 AC_CONFIG_FILES([Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile doc/Makefile])