2 AC_INIT([xmltooling], [1.0], [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.0])
8 sinclude(acx_pthread.m4)
19 DX_INIT_DOXYGEN(xmltooling, doxygen.cfg, doc/api)
22 AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)]),
23 enable_debug=$enableval, enable_debug=no)
25 if test "$enable_debug" = "yes" ; then
26 GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
27 GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
29 GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
30 GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
33 AC_PROG_CC([gcc gcc3 cc])
34 AC_PROG_CXX([g++ g++3 c++ CC])
37 if test "$GCC" = "yes" ; then
38 # AC_HAVE_GCC_VERSION(4,0,0,0,
40 # AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
41 # [Define to enable class visibility control in gcc.])
42 # GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
43 # GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
45 CFLAGS="-Wall $GCC_CFLAGS"
46 CXXFLAGS="-Wall $GCC_CXXFLAGS"
48 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
49 case "${host_cpu}-${host_os}" in
51 if test "$CXX" = "CC" ; then
52 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
61 # Checks for typedefs, structures, and compiler characteristics.
65 # Checks for library functions.
66 AC_CHECK_FUNCS([strchr strdup strstr timegm strcasecmp])
67 AC_CHECK_HEADERS([dlfcn.h])
68 AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
71 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
72 if test $enable_threads != "pthread"; then
73 AC_MSG_ERROR([unable to find pthreads, currently this is required])
75 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
76 AM_CONDITIONAL(BUILD_PTHREAD,test "$enable_threads" = "pthread")
77 LIBS="$PTHREAD_LIBS $LIBS"
78 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
79 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
82 AC_CHECK_FUNCS([pthread_rwlock_init])
90 # are covariant methods allowed?
92 [ class base { public: virtual base *GetPtr( void ) { return this; } }; ],
93 [ class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } }; ],
94 [AC_DEFINE(HAVE_COVARIANT_RETURNS,1,[Define if C++ compiler supports covariant virtual methods.])])
96 # log4shib settings (favor this version over the log4cpp code)
97 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
99 AC_HELP_STRING([--with-log4shib=PATH], [where log4shib-config is installed]),
101 LOG4SHIB_CONFIG="${with_log4shib}"
102 if ! test -f "${LOG4SHIB_CONFIG}" ; then
103 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
106 if test -f "${LOG4SHIB_CONFIG}"; then
107 LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS"
108 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
109 AC_CHECK_HEADER([log4shib/Category.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
111 [#include <log4shib/Category.hh>],
112 [log4shib::Category::getInstance("foo")],
113 [AC_DEFINE(XMLTOOLING_LOG4SHIB,1,[Define if log4shib library is used.])],
114 [AC_MSG_ERROR([unable to link with log4shib])])
116 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
117 AC_MSG_WARN([will look for original log4cpp library])
120 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
122 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]),
124 LOG4CPP_CONFIG="${with_log4cpp}"
125 if ! test -f "${LOG4CPP_CONFIG}" ; then
126 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
129 if test -f "${LOG4CPP_CONFIG}"; then
130 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
131 LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
132 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
133 AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
134 AC_CHECK_HEADER([log4cpp/PropertyConfigurator.hh],,AC_MSG_ERROR([you need at least log4cpp 0.3.x]))
136 [#include <log4cpp/Category.hh>],
137 [log4cpp::Category::getInstance("foo")],
138 [AC_DEFINE(XMLTOOLING_LOG4CPP,1,[Define if log4cpp library is used.])],
139 [AC_MSG_ERROR([unable to link with log4cpp])])
141 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
147 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
148 [if test x_$with_xerces != x_/usr; then
149 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
150 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
152 LIBS="-lxerces-c $LIBS"
153 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
154 AC_MSG_CHECKING([Xerces version])
156 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
157 [#if _XERCES_VERSION != 20600
160 #error cannot use version 2.6.0
163 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
165 [#include <xercesc/util/PlatformUtils.hpp>],
166 [xercesc::XMLPlatformUtils::Initialize()],
167 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
168 [AC_MSG_ERROR([unable to link with Xerces])])
171 # XML-Security settings
173 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
176 if test x_$with_xmlsec != x_no; then
177 if test x_$with_xmlsec != x_/usr; then
178 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
179 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
181 XMLSEC_LIBS="-lxml-security-c"
183 # save and append master libs
185 LIBS="$XMLSEC_LIBS $LIBS"
187 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
188 AC_MSG_CHECKING([XML-Security version])
190 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
191 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3) || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM == 3 && XSEC_VERSION_MINOR > 0)
194 #error need version 1.3.1 or later
197 [AC_MSG_FAILURE([XML-Security version 1.3.1 or greater is required.])])
199 [#include <xsec/utils/XSECPlatformUtils.hpp>],
200 [XSECPlatformUtils::Initialise()],,
201 [AC_MSG_ERROR([unable to link with XML-Sec])])
203 # restore master libs
209 AC_PATH_PROG(CURL_CONFIG,curl-config)
211 AC_HELP_STRING([--with-curl=PATH], [where curl-config is installed]),
213 CURL_CONFIG="${with_curl}"
214 if ! test -f "${CURL_CONFIG}" ; then
215 CURL_CONFIG="${with_curl}/bin/curl-config"
218 if test -f "${CURL_CONFIG}" ; then
219 CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
220 XMLSEC_LIBS="`${CURL_CONFIG} --libs` $XMLSEC_LIBS"
222 AC_MSG_ERROR([curl-config not found, may need to use --with-curl option])
225 # save and append master libs
227 LIBS="$XMLSEC_LIBS $LIBS"
229 AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
230 AC_CHECK_LIB([curl],[curl_global_init],,AC_MSG_ERROR([unable to link with libcurl]))
231 AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
232 AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
233 [AC_MSG_RESULT(yes)],
234 [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
236 # restore master libs
241 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
242 [if test x_$with_openssl != x_/usr; then
243 SSLFLAGS="-I${with_openssl}/include"
244 SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
247 if test "x$SSLLIBS" = "x" ; then
248 AC_PATH_PROG(PKG_CONFIG, pkg-config)
249 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
250 if pkg-config openssl ; then
251 SSLLIBS="`$PKG_CONFIG --libs openssl`"
252 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
254 AC_MSG_ERROR([OpenSSL not supported by pkg-config, try --with-openssl instead])
259 if test "x$SSLLIBS" = "x" ; then
260 SSLLIBS="-lcrypto -lssl"
263 AC_MSG_CHECKING(for OpenSSL cflags)
264 AC_MSG_RESULT($SSLFLAGS)
265 CPPFLAGS="$CPPFLAGS $SSLFLAGS"
266 AC_MSG_CHECKING(for OpenSSL libraries)
267 AC_MSG_RESULT($SSLLIBS)
268 XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
270 # save and append master libs
272 LIBS="$XMLSEC_LIBS $LIBS"
274 AC_CHECK_HEADER([openssl/pem.h],,
275 AC_MSG_ERROR([unable to find openssl header files]))
276 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
277 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
278 AC_MSG_ERROR([unable to link with openssl libraries]))
281 # restore master libs
284 AC_SUBST(XMLSEC_LIBS)
288 AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
289 AC_DEFINE(XMLTOOLING_NO_XMLSEC,1,
290 [Define if you wish to disable XML-Security-dependent features.])
292 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
294 # Does the STL in use help or screw us?
297 [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
298 [AC_DEFINE(HAVE_GOOD_STL,1,
299 [Define if you have an STL implementation that supports useful string specialization.])],
302 # Check for unit test support
303 CXXTEST="/usr/bin/cxxtestgen.pl"
306 AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
307 [if test x_$with_cxxtest != x_/usr; then
308 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
309 CXXTESTFLAGS="-I${with_cxxtest}"
311 if ! test -f "${CXXTEST}"; then
312 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
316 AC_SUBST(CXXTESTFLAGS)
317 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
319 LIBTOOL="$LIBTOOL --silent"
322 AC_OUTPUT(Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile doc/Makefile)