2 AC_INIT([shibboleth-resolver], [0.1], [shibboleth-users@internet2.edu], [shibboleth-resolver])
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE([shibboleth-resolver],[0.1])
6 sinclude(acx_pthread.m4)
9 AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)
11 enable_debug=$enableval, enable_debug=no)
13 if test "$enable_debug" = "yes" ; then
14 GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
15 GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
17 GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
18 GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
21 AC_PROG_CC([gcc gcc3 cc])
22 AC_PROG_CXX([g++ g++3 c++ CC])
25 if test "$GCC" = "yes" ; then
26 # AC_HAVE_GCC_VERSION(4,0,0,0,
28 # AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
29 # [Define to enable class visibility control in gcc.])
30 # GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
31 # GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
33 CFLAGS="-Wall $GCC_CFLAGS"
34 CXXFLAGS="-Wall $GCC_CXXFLAGS"
36 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
37 case "${host_cpu}-${host_os}" in
39 if test "$CXX" = "CC" ; then
40 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
44 CXXFLAGS="$CXXFLAGS -D_POSIX_PII_SOCKET"
54 # Checks for typedefs, structures, and compiler characteristics.
59 # Checks for library functions.
60 AC_CHECK_FUNCS([strcasecmp])
63 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
64 if test $enable_threads != "pthread"; then
65 AC_MSG_ERROR([unable to find pthreads, currently this is required])
67 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
68 LIBS="$PTHREAD_LIBS $LIBS"
69 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
70 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
79 # log4shib settings (favor this version over the log4cpp code)
80 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
82 AC_HELP_STRING([--with-log4shib=PATH], [where log4shib-config is installed]),
84 LOG4SHIB_CONFIG="${with_log4shib}"
85 if ! test -f "${LOG4SHIB_CONFIG}" ; then
86 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
89 if test -f "${LOG4SHIB_CONFIG}"; then
90 LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS"
91 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
92 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
94 [#include <log4shib/Category.hh>
95 #include <log4shib/CategoryStream.hh>],
96 [log4shib::Category::getInstance("foo").errorStream() << log4shib::eol],
97 [AC_DEFINE(SHIBRESOLVER_LOG4SHIB,1,[Define if log4shib library is used.])],
98 [AC_MSG_ERROR([unable to link with log4shib])])
100 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
101 AC_MSG_WARN([will look for original log4cpp library])
104 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
106 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]),
108 LOG4CPP_CONFIG="${with_log4cpp}"
109 if ! test -f "${LOG4CPP_CONFIG}" ; then
110 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
113 if test -f "${LOG4CPP_CONFIG}"; then
114 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
115 LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
116 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
117 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
119 [#include <log4cpp/Category.hh>
120 #include <log4cpp/CategoryStream.hh>],
121 [log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol],
122 [AC_DEFINE(SHIBRESOLVER_LOG4CPP,1,[Define if log4cpp library is used.])],
123 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
125 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
131 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
132 [if test x_$with_xerces != x_/usr; then
133 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
134 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
136 LIBS="-lxerces-c $LIBS"
137 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,
138 AC_MSG_ERROR([unable to find xerces header files]))
139 AC_MSG_CHECKING([Xerces version])
141 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
142 [#if _XERCES_VERSION != 20600
145 #error cannot use version 2.6.0
148 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
150 [#include <xercesc/util/PlatformUtils.hpp>],
151 [xercesc::XMLPlatformUtils::Initialize()],
152 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
153 [AC_MSG_ERROR([unable to link with Xerces])])
156 #XML-Tooling settings
157 AC_ARG_WITH(xmltooling,
158 AC_HELP_STRING([--with-xmltooling=PATH], [where xmltooling-c is installed]),
159 [if test x_$with_xmltooling != x_/usr; then
160 LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
161 CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
163 LITE_LIBS="-lxmltooling-lite"
164 XMLSEC_LIBS="-lxmltooling"
165 AC_CHECK_HEADER([xmltooling/base.h],,
166 AC_MSG_ERROR([unable to find xmltooling header files]))
168 # XML-Security settings
170 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
173 if test x_$with_xmlsec != x_/usr; then
174 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
175 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
177 XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
179 # save and append master libs
181 LIBS="$XMLSEC_LIBS $LIBS"
183 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
184 AC_MSG_CHECKING([XML-Security version])
186 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
187 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
190 #error need version 1.4.0 or later
193 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
195 [#include <xsec/utils/XSECPlatformUtils.hpp>],
196 [XSECPlatformUtils::Initialise()],,
197 [AC_MSG_ERROR([unable to link with XML-Security])])
199 # restore master libs
204 AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
205 [if test x_$with_saml != x_/usr; then
206 LDFLAGS="-L${with_saml}/lib $LDFLAGS"
207 CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
209 XMLSEC_LIBS="-lsaml $XMLSEC_LIBS"
211 # save and append master libs
213 LIBS="$XMLSEC_LIBS $LIBS"
215 AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],,
216 AC_MSG_ERROR([unable to find OpenSAML header files]))
218 [#include <saml/SAMLConfig.h>],
219 [opensaml::SAMLConfig::getConfig()],
220 [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])],
221 [AC_MSG_ERROR([unable to link with OpenSAML])])
223 # restore master libs
226 # Shibboleth SP settings
228 AC_HELP_STRING([--with-shibsp=PATH], [where Shibboleth SP is installed]),
229 [if test x_$with_shibsp != x_/usr; then
230 LDFLAGS="-L${with_shibsp}/lib $LDFLAGS"
231 CPPFLAGS="-I${with_shibsp}/include $CPPFLAGS"
233 LITE_LIBS="-lshibsp-lite $LITE_LIBS"
234 XMLSEC_LIBS="-lshibsp $XMLSEC_LIBS"
236 # save and append master libs
238 LIBS="$XMLSEC_LIBS $LIBS"
240 AC_CHECK_HEADER([shibsp/SPConfig.h],,
241 AC_MSG_ERROR([unable to find Shibboleth SP header files]))
243 [#include <shibsp/SPConfig.h>],
244 [shibsp::SPConfig::getConfig()],
245 [AC_DEFINE(HAVE_SHIBSP,1,[Define if Shibboleth SP library was found])],
246 [AC_MSG_ERROR([unable to link with Shibboleth SP])])
248 AC_MSG_CHECKING([whether SP library supports non-plugin remoting])
249 AC_TRY_COMPILE([#include <shibsp/ServiceProvider.hpp>],
250 [shibsp::ServiceProvider* sp;
251 sp->regListener(NULL,NULL);
253 [AC_MSG_RESULT([yes])]
254 [AC_DEFINE([SHIBRESOLVER_SHIBSP_HAS_REMOTING], [1], [Define to 1 if Shibboleth SP supports non-plugin remoting.])],
255 [AC_MSG_RESULT([no])])
257 # restore master libs
261 AC_SUBST(XMLSEC_LIBS)
263 AC_CONFIG_FILES([resolver.spec Portfile])
265 # output the underlying makefiles
266 AC_CONFIG_FILES([Makefile doc/Makefile shibresolver/Makefile])
268 LIBTOOL="$LIBTOOL --silent"