2 AC_INIT([opensaml], [2.0], [mace-opensaml-users@internet2.edu], [saml])
3 AM_CONFIG_HEADER(config.h)
4 #AM_CONFIG_HEADER(saml/config_pub.h)
5 AM_INIT_AUTOMAKE([opensaml], [2.0])
8 sinclude(acx_pthread.m4)
19 DX_INIT_DOXYGEN(opensaml, 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 -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_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"
47 CXXFLAGS="$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.
66 # Checks for library functions.
67 AC_CHECK_FUNCS([strchr strdup strstr])
68 AC_CHECK_SIZEOF(time_t)
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 LIBS="$PTHREAD_LIBS $LIBS"
77 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
78 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
83 AC_HELP_STRING([--with-zlib=PATH], [where zlib is installed]),
85 if test -d "$withval"; then
86 CPPFLAGS="${CPPFLAGS} -I$withval/include"
87 LDFLAGS="${LDFLAGS} -L$withval/lib"
91 AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
92 AC_CHECK_LIB([z],[deflateInit2_],,AC_MSG_ERROR([unable to link with zlib library]))
96 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
97 [if test x_$with_openssl != x_/usr; then
98 SSLFLAGS="-I${with_openssl}/include"
101 if test "x$SSLFLAGS" = "x" ; then
102 AC_PATH_PROG(PKG_CONFIG, pkg-config)
103 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
104 if pkg-config openssl ; then
105 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
107 AC_MSG_ERROR([OpenSSL not supported by pkg-config, try --with-openssl instead])
112 AC_MSG_CHECKING(for OpenSSL cflags)
113 AC_MSG_RESULT($SSLFLAGS)
114 CPPFLAGS="$SSLFLAGS $CPPFLAGS"
116 AC_CHECK_HEADER([openssl/x509.h],,
117 AC_MSG_ERROR([unable to find openssl header files]))
125 # log4shib settings (favor this version over the log4cpp code)
126 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
127 AC_ARG_WITH(log4shib,
128 AC_HELP_STRING([--with-log4shib=PATH], [where log4shib-config is installed]),
130 LOG4SHIB_CONFIG="${with_log4shib}"
131 if ! test -f "${LOG4SHIB_CONFIG}" ; then
132 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
135 if test -f "${LOG4SHIB_CONFIG}"; then
136 LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS"
137 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
138 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
140 [#include <log4shib/Category.hh> #include <log4shib/CategoryStream.hh>],
141 [log4shib::Category::getInstance("foo").errorStream() << log4shib::eol],
142 [AC_DEFINE(OPENSAML_LOG4SHIB,1,[Define if log4shib library is used.])],
143 [AC_MSG_ERROR([unable to link with log4shib])])
145 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
146 AC_MSG_WARN([will look for original log4cpp library])
149 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
151 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]),
153 LOG4CPP_CONFIG="${with_log4cpp}"
154 if ! test -f "${LOG4CPP_CONFIG}" ; then
155 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
158 if test -f "${LOG4CPP_CONFIG}"; then
159 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
160 LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
161 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
162 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
164 [#include <log4cpp/Category.hh> #include <log4cpp/CategoryStream.hh>],
165 [log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol],
166 [AC_DEFINE(OPENSAML_LOG4CPP,1,[Define if log4cpp library is used.])],
167 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
169 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
175 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
176 [if test x_$with_xerces != x_/usr; then
177 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
178 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
180 LIBS="-lxerces-c $LIBS"
181 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
182 AC_MSG_CHECKING([Xerces version])
184 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
185 [#if _XERCES_VERSION != 20600
188 #error cannot use version 2.6.0
191 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use special 2.6.1 tarball provided by Shibboleth Project])])
193 [#include <xercesc/util/PlatformUtils.hpp>],
194 [xercesc::XMLPlatformUtils::Initialize()],
195 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
196 [AC_MSG_ERROR([unable to link with Xerces])])
199 # XML-Security settings
201 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
202 [if test x_$with_xmlsec != x_/usr; then
203 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
204 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
206 LIBS="-lxml-security-c $LIBS"
207 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find xmlsec header files]))
208 AC_MSG_CHECKING([XML-Security version])
210 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
211 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
214 #error need version 1.4.0 or later
217 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
219 [#include <xsec/utils/XSECPlatformUtils.hpp>],
220 [XSECPlatformUtils::Initialise()],
221 [AC_DEFINE(HAVE_LIBXSEC,1,[Define if XML-Security library was found])],
222 [AC_MSG_ERROR([unable to link with XML-Security library])]
225 # XML-Tooling settings
226 AC_ARG_WITH(xmltooling,
227 AC_HELP_STRING([--with-xmltooling=PATH], [where xmltooling is installed]),
228 [if test x_$with_xmltooling != x_/usr; then
229 LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
230 CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
231 DX_INCLUDE="${with_xmltooling}/include"
233 LIBS="-lxmltooling $LIBS"
234 AC_CHECK_HEADER([xmltooling/XMLToolingConfig.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
236 [#include <xmltooling/XMLToolingConfig.h>],
237 [xmltooling::XMLToolingConfig::getConfig().init()],
238 [AC_DEFINE(HAVE_LIBXMLTOOLING,1,[Define if XML-Tooling library was found])],
239 [AC_MSG_ERROR([unable to link with xmltooling library])]
242 # Does the STL in use help or screw us?
245 [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
246 [AC_DEFINE(HAVE_GOOD_STL,1,
247 [Define if you have an STL implementation that supports useful string specialization.])],
250 # Check for unit test support
251 CXXTEST="/usr/bin/cxxtestgen.pl"
254 AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
255 [if test x_$with_cxxtest != x_/usr; then
256 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
257 CXXTESTFLAGS="-I${with_cxxtest}"
259 if ! test -f "${CXXTEST}"; then
260 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
264 AC_SUBST(CXXTESTFLAGS)
265 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
268 LIBTOOL="$LIBTOOL --silent"
271 AC_OUTPUT(Makefile saml/Makefile samltest/Makefile samlsign/Makefile schemas/Makefile doc/Makefile)