2 AC_INIT([opensaml],[2.5],[https://issues.shibboleth.net/],[opensaml])
4 AC_CONFIG_AUX_DIR(build-aux)
5 AC_CONFIG_MACRO_DIR(m4)
19 DX_INIT_DOXYGEN(opensaml, 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 -Wall -g -D_DEBUG"
28 GCC_CXXFLAGS="$CXXFLAGS -Wall -g -D_DEBUG"
30 GCC_CFLAGS="$CFLAGS -Wall -O2 -DNDEBUG"
31 GCC_CXXFLAGS="$CXXFLAGS -Wall -O2 -DNDEBUG"
34 AC_CONFIG_HEADERS([config.h])
35 AC_CONFIG_FILES([opensaml.spec])
36 AC_CONFIG_FILES([Makefile saml/Makefile samltest/Makefile samlsign/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"
51 CXXFLAGS="$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.
68 # Checks for library functions.
69 AC_CHECK_FUNCS([strchr strdup strstr])
70 AC_CHECK_SIZEOF(time_t)
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 LIBS="$PTHREAD_LIBS $LIBS"
79 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
80 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
85 AS_HELP_STRING([--with-zlib=PATH],[where zlib is installed]),
87 if test -d "$withval" ; then
88 CPPFLAGS="${CPPFLAGS} -I$withval/include"
89 LDFLAGS="${LDFLAGS} -L$withval/lib"
95 AS_HELP_STRING([--with-zlib=PATH],[where zlib is installed]),,
97 if test x_$with_zlib != x_/usr; then
98 CPPFLAGS="-I${with_zlib}/include $CPPFLAGS"
99 LIBS="-L${with_zlib}/lib -lz $LIBS"
104 AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
106 [AC_LANG_PROGRAM([[#include <zlib.h>]],
107 [[zlibVersion()]])],,
108 [AC_MSG_ERROR([unable to link with zlib])])
113 AS_HELP_STRING([--with-openssl=PATH],[where openssl is installed]),
114 [if test x_$with_openssl != x_/usr; then
115 SSLFLAGS="-I${with_openssl}/include"
118 if test "x$with_openssl" = "x" ; then
119 AC_PATH_PROG(PKG_CONFIG, pkg-config)
120 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
121 if pkg-config openssl ; then
122 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
124 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
129 AC_MSG_CHECKING(for OpenSSL cflags)
130 AC_MSG_RESULT($SSLFLAGS)
131 CPPFLAGS="$SSLFLAGS $CPPFLAGS"
133 AC_CHECK_HEADER([openssl/x509.h],,AC_MSG_ERROR([unable to find openssl header files]))
141 # log4shib settings (favor this version over the log4cpp code)
142 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
143 AC_ARG_WITH(log4shib,
144 AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
146 LOG4SHIB_CONFIG="${with_log4shib}"
147 if ! test -f "${LOG4SHIB_CONFIG}"; then
148 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
151 if test -f "${LOG4SHIB_CONFIG}" ; then
152 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
153 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
154 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
156 [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
157 #include <log4shib/CategoryStream.hh>]],
158 [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
159 [AC_DEFINE([OPENSAML_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
160 [AC_MSG_ERROR([unable to link with log4shib])])
162 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
163 AC_MSG_WARN([will look for original log4cpp library])
166 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
168 AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
170 LOG4CPP_CONFIG="${with_log4cpp}"
171 if ! test -f "${LOG4CPP_CONFIG}"; then
172 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
175 if test -f "${LOG4CPP_CONFIG}"; then
176 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
177 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
178 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
179 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
181 [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
182 #include <log4cpp/CategoryStream.hh>]],
183 [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
184 [AC_DEFINE([OPENSAML_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
185 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
187 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
193 AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),,
195 if test x_$with_xerces != x_/usr; then
196 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
197 LIBS="-L${with_xerces}/lib -lxerces-c $LIBS"
199 LIBS="-lxerces-c $LIBS"
202 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
203 AC_MSG_CHECKING([Xerces version])
205 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
206 [#if _XERCES_VERSION != 20600
209 #error cannot use version 2.6.0
212 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
214 [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],[[xercesc::XMLPlatformUtils::Initialize()]])],
215 ,[AC_MSG_ERROR([unable to link with Xerces])])
217 AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
219 [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
220 [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
221 [AC_MSG_RESULT([yes])AC_DEFINE([OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
222 [AC_MSG_RESULT([no])])
224 # XML-Security settings
226 AS_HELP_STRING([--with-xmlsec=PATH],[where xmlsec is installed]),,
228 if test x_$with_xmlsec != x_/usr; then
229 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
230 LIBS="-L${with_xmlsec}/lib -lxml-security-c $LIBS"
232 LIBS="-lxml-security-c $LIBS"
234 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find xmlsec header files]))
235 AC_MSG_CHECKING([XML-Security version])
237 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
238 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
241 #error need version 1.4.0 or later
244 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
246 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
247 [[XSECPlatformUtils::Initialise()]])],,
248 [AC_MSG_ERROR([unable to link with XML-Security])])
250 # XML-Tooling settings
251 AC_ARG_WITH(xmltooling,
252 AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling is installed]),,
253 [with_xmltooling=/usr])
254 if test x_$with_xmltooling != x_/usr; then
255 CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
256 DX_INCLUDE="${with_xmltooling}/include"
257 LIBS="-L${with_xmltooling}/lib -lxmltooling $LIBS"
259 LIBS="-lxmltooling $LIBS"
262 AC_CHECK_HEADER([xmltooling/XMLToolingConfig.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
265 [AC_LANG_PROGRAM([[#include <xmltooling/XMLToolingConfig.h>
266 #include <xmltooling/version.h>]],
267 [[#if _XMLTOOLING_VERSION >= 10400
268 xmltooling::XMLToolingConfig::getConfig();
270 #error Need XMLTooling version 1.4 or higher
272 ,[AC_MSG_ERROR([unable to link with XMLTooling, or version was too old])])
274 # Check for unit test support
275 CXXTEST="/usr/bin/cxxtestgen.pl"
278 AS_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
279 [if test x_$with_cxxtest != x_/usr; then
280 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
281 CXXTESTFLAGS="-I${with_cxxtest}"
283 if ! test -f "${CXXTEST}"; then
284 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
288 AC_SUBST(CXXTESTFLAGS)
289 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
291 AX_CREATE_PKGCONFIG_INFO(,,[$LIBS -lsaml],[OpenSAML library])
294 LIBTOOL="$LIBTOOL --silent"
296 # output packaging and makefiles