2 AC_INIT([opensaml],[2.4],[https://bugs.internet2.edu/],[opensaml])
4 AC_CONFIG_AUX_DIR(build-aux)
5 AC_CONFIG_MACRO_DIR(m4)
18 DX_INIT_DOXYGEN(opensaml, 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 -Wall -g -D_DEBUG"
27 GCC_CXXFLAGS="$CXXFLAGS -Wall -g -D_DEBUG"
29 GCC_CFLAGS="$CFLAGS -Wall -O2 -DNDEBUG"
30 GCC_CXXFLAGS="$CXXFLAGS -Wall -O2 -DNDEBUG"
33 AC_CONFIG_HEADERS([config.h])
34 AC_CONFIG_FILES([opensaml.spec pkginfo Portfile])
35 AC_CONFIG_FILES([Makefile saml/Makefile samltest/Makefile samlsign/Makefile schemas/Makefile doc/Makefile])
37 AC_PROG_CC([gcc gcc3 cc])
38 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.
67 # Checks for library functions.
68 AC_CHECK_FUNCS([strchr strdup strstr])
69 AC_CHECK_SIZEOF(time_t)
72 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
73 if test $enable_threads != "pthread"; then
74 AC_MSG_ERROR([unable to find pthreads, currently this is required])
76 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
77 LIBS="$PTHREAD_LIBS $LIBS"
78 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
79 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
84 AS_HELP_STRING([--with-zlib=PATH],[where zlib is installed]),
86 if test -d "$withval" ; then
87 CPPFLAGS="${CPPFLAGS} -I$withval/include"
88 LDFLAGS="${LDFLAGS} -L$withval/lib"
92 AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
93 AC_CHECK_LIB([z],[deflateInit2_],,AC_MSG_ERROR([unable to link with zlib library]))
97 AS_HELP_STRING([--with-openssl=PATH],[where openssl is installed]),
98 [if test x_$with_openssl != x_/usr; then
99 SSLFLAGS="-I${with_openssl}/include"
102 if test "x$with_openssl" = "x" ; then
103 AC_PATH_PROG(PKG_CONFIG, pkg-config)
104 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
105 if pkg-config openssl ; then
106 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
108 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
113 AC_MSG_CHECKING(for OpenSSL cflags)
114 AC_MSG_RESULT($SSLFLAGS)
115 CPPFLAGS="$SSLFLAGS $CPPFLAGS"
117 AC_CHECK_HEADER([openssl/x509.h],,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 AS_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 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
137 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
138 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
140 [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
141 #include <log4shib/CategoryStream.hh>]],
142 [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
143 [AC_DEFINE([OPENSAML_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
144 [AC_MSG_ERROR([unable to link with log4shib])])
146 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
147 AC_MSG_WARN([will look for original log4cpp library])
150 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
152 AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
154 LOG4CPP_CONFIG="${with_log4cpp}"
155 if ! test -f "${LOG4CPP_CONFIG}"; then
156 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
159 if test -f "${LOG4CPP_CONFIG}"; then
160 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
161 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
162 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
163 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
165 [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
166 #include <log4cpp/CategoryStream.hh>]],
167 [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
168 [AC_DEFINE([OPENSAML_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
169 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
171 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
177 AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),
178 [if test x_$with_xerces != x_/usr; then
179 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
180 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
182 LIBS="-lxerces-c $LIBS"
183 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
184 AC_MSG_CHECKING([Xerces version])
186 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
187 [#if _XERCES_VERSION != 20600
190 #error cannot use version 2.6.0
193 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
195 [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],[[xercesc::XMLPlatformUtils::Initialize()]])],
196 ,[AC_MSG_ERROR([unable to link with Xerces])])
198 AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
200 [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
201 [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
202 [AC_MSG_RESULT([yes])AC_DEFINE([OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
203 [AC_MSG_RESULT([no])])
205 # XML-Security settings
207 AS_HELP_STRING([--with-xmlsec=PATH],[where xmlsec is installed]),
208 [if test x_$with_xmlsec != x_/usr; then
209 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
210 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
212 LIBS="-lxml-security-c $LIBS"
213 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find xmlsec header files]))
214 AC_MSG_CHECKING([XML-Security version])
216 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
217 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
220 #error need version 1.4.0 or later
223 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
225 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
226 [[XSECPlatformUtils::Initialise()]])],,
227 [AC_MSG_ERROR([unable to link with XML-Security])])
229 # XML-Tooling settings
230 AC_ARG_WITH(xmltooling,
231 AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling is installed]),
232 [if test x_$with_xmltooling != x_/usr; then
233 LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
234 CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
235 DX_INCLUDE="${with_xmltooling}/include"
237 LIBS="-lxmltooling $LIBS"
238 AC_CHECK_HEADER([xmltooling/XMLToolingConfig.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
242 #include <xmltooling/XMLToolingConfig.h>
243 #include <xmltooling/version.h>
246 #if _XMLTOOLING_VERSION >= 10400
247 xmltooling::XMLToolingConfig::getConfig();
249 #error Need XMLTooling version 1.4 or higher
252 ,[AC_MSG_ERROR([unable to link with XMLTooling, or version was too old])])
254 # Check for unit test support
255 CXXTEST="/usr/bin/cxxtestgen.pl"
258 AS_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
259 [if test x_$with_cxxtest != x_/usr; then
260 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
261 CXXTESTFLAGS="-I${with_cxxtest}"
263 if ! test -f "${CXXTEST}"; then
264 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
268 AC_SUBST(CXXTESTFLAGS)
269 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
271 AX_CREATE_PKGCONFIG_INFO(,,[$LIBS -lsaml],[OpenSAML library])
274 LIBTOOL="$LIBTOOL --silent"
276 # output packaging and makefiles