2 AC_INIT([shibboleth-resolver], [0.3], [MOONSHOT-COMMUNITY@JISCMAIL.AC.UK], [shibboleth-resolver])
4 AC_CONFIG_AUX_DIR(build-aux)
5 AC_CONFIG_MACRO_DIR(m4)
11 AS_HELP_STRING([--enable-debug],[Have GCC compile with symbols (Default = no)]),
12 enable_debug=$enableval, enable_debug=no)
14 if test "$enable_debug" = "yes" ; then
15 GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
16 GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
18 GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
19 GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
22 AC_CONFIG_HEADERS([config.h src/shibresolver/config_pub.h])
23 AC_CONFIG_FILES([resolver.spec Portfile])
24 AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile])
26 AC_PROG_CC([gcc gcc3 cc])
27 AC_PROG_CXX([g++ g++3 c++ CC])
30 if test "$GCC" = "yes" ; then
31 # AC_HAVE_GCC_VERSION(4,0,0,0,
33 # AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
34 # [Define to enable class visibility control in gcc.])
35 # GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
36 # GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
38 CFLAGS="-Wall $GCC_CFLAGS"
39 CXXFLAGS="-Wall $GCC_CXXFLAGS"
41 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
42 case "${host_cpu}-${host_os}" in
44 if test "$CXX" = "CC" ; then
45 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
49 CXXFLAGS="$CXXFLAGS -D_POSIX_PII_SOCKET"
56 # Checks for typedefs, structures, and compiler characteristics.
61 # Checks for library functions.
62 AC_CHECK_FUNCS([strcasecmp])
65 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
66 if test $enable_threads != "pthread"; then
67 AC_MSG_ERROR([unable to find pthreads, currently this is required])
69 AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])
70 LIBS="$PTHREAD_LIBS $LIBS"
71 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
72 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
81 # are covariant methods allowed?
83 [AC_LANG_PROGRAM([[]],
85 class base { public: virtual base *GetPtr( void ) { return this; } };
86 class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } };
88 [AC_DEFINE([HAVE_COVARIANT_RETURNS],[1],[Define to 1 if C++ compiler supports covariant virtual methods.])])
90 # is nullptr supported?
92 [AC_LANG_PROGRAM([[]],[[const char* ptr = nullptr;]])],
93 [AC_DEFINE([HAVE_NULLPTR],[1],[Define to 1 if C++ compiler supports nullptr keyword.])])
95 # log4shib settings (favor this version over the log4cpp code)
96 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
98 AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
100 LOG4SHIB_CONFIG="${with_log4shib}"
101 if ! test -f "${LOG4SHIB_CONFIG}" ; then
102 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
105 if test -f "${LOG4SHIB_CONFIG}"; then
106 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
107 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
108 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
110 [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
111 #include <log4shib/CategoryStream.hh>]],
112 [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
113 [AC_DEFINE([SHIBRESOLVER_LOG4SHIB],[1],[Define to 1 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 AS_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 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
132 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
133 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
135 [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
136 #include <log4cpp/CategoryStream.hh>]],
137 [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
138 [AC_DEFINE([SHIBRESOLVER_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
139 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
141 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
148 AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),
149 [if test x_$with_xerces != x_/usr; then
150 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
151 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
153 LIBS="-lxerces-c $LIBS"
154 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
155 AC_MSG_CHECKING([Xerces version])
157 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
158 [#if _XERCES_VERSION != 20600
161 #error cannot use version 2.6.0
164 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
166 [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
167 [[xercesc::XMLPlatformUtils::Initialize()]])],
168 ,[AC_MSG_ERROR([unable to link with Xerces])])
171 #XML-Tooling settings
172 AC_ARG_WITH(xmltooling,
173 AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling-c is installed]),
174 [if test x_$with_xmltooling != x_/usr; then
175 LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
176 CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
178 LITE_LIBS="-lxmltooling-lite"
179 XMLSEC_LIBS="-lxmltooling"
180 AC_CHECK_HEADER([xmltooling/base.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
182 # XML-Security settings
184 AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
187 if test x_$with_xmlsec != x_/usr; then
188 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
189 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
191 XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
193 # save and append master libs
195 LIBS="$XMLSEC_LIBS $LIBS"
197 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
198 AC_MSG_CHECKING([XML-Security version])
200 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
201 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
204 #error need version 1.4.0 or later
207 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
209 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
210 [[XSECPlatformUtils::Initialise()]])],,
211 [AC_MSG_ERROR([unable to link with XML-Security])])
213 # restore master libs
218 AS_HELP_STRING([--with-saml=PATH],[where saml is installed]),
219 [if test x_$with_saml != x_/usr; then
220 LDFLAGS="-L${with_saml}/lib $LDFLAGS"
221 CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
223 XMLSEC_LIBS="-lsaml $XMLSEC_LIBS"
225 # save and append master libs
227 LIBS="$XMLSEC_LIBS $LIBS"
229 AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],,AC_MSG_ERROR([unable to find OpenSAML header files]))
231 [AC_LANG_PROGRAM([[#include <saml/SAMLConfig.h>]],
232 [[opensaml::SAMLConfig::getConfig()]])],
233 ,[AC_MSG_ERROR([unable to link with OpenSAML])])
235 # restore master libs
238 # Shibboleth SP settings
240 AS_HELP_STRING([--with-shibsp=PATH],[where Shibboleth SP is installed]),
241 [if test x_$with_shibsp != x_/usr; then
242 LDFLAGS="-L${with_shibsp}/lib $LDFLAGS"
243 CPPFLAGS="-I${with_shibsp}/include $CPPFLAGS"
245 LITE_LIBS="-lshibsp-lite $LITE_LIBS"
246 XMLSEC_LIBS="-lshibsp $XMLSEC_LIBS"
248 # save and append master libs
250 LIBS="$XMLSEC_LIBS $LIBS"
252 AC_CHECK_HEADER([shibsp/SPConfig.h],,AC_MSG_ERROR([unable to find Shibboleth SP header files]))
254 [AC_LANG_PROGRAM([[#include <shibsp/SPConfig.h>]],
255 [[shibsp::SPConfig::getConfig()]])],
256 ,[AC_MSG_ERROR([unable to link with Shibboleth SP])])
258 AC_MSG_CHECKING([whether SP library supports non-plugin remoting])
263 #include <shibsp/ServiceProvider.h>
265 [[shibsp::ServiceProvider* sp; sp->regListener(NULL,NULL);]])],
266 [AC_MSG_RESULT([yes])AC_DEFINE([SHIBRESOLVER_SHIBSP_HAS_REMOTING],[1],[Define to 1 if Shibboleth SP supports non-plugin remoting.])],
267 [AC_MSG_RESULT([no])])
269 # restore master libs
275 AC_ARG_WITH(gssapi-includes,
276 AS_HELP_STRING([--with-gssapi-includes=DIR],[Specify location of GSSAPI header]),
277 [ GSSAPI_INCS="-I$withval"
281 AC_ARG_WITH(gssapi-libs,
282 AS_HELP_STRING([--with-gssapi-libs=DIR],[Specify location of GSSAPI libs]),
283 [ GSSAPI_LIB_DIR="-L$withval"
288 AS_HELP_STRING([--with-gssapi=DIR],[Where to look for GSSAPI]),
289 [ GSSAPI_ROOT="$withval"
290 if test x"$GSSAPI_ROOT" != xno; then
292 if test x"$GSSAPI_ROOT" = xyes; then
293 dnl if yes, then use default root
299 save_CPPFLAGS="$CPPFLAGS"
300 AC_MSG_CHECKING([if GSSAPI support is requested])
301 if test x"$want_gss" = xyes; then
304 if test -z "$GSSAPI_INCS"; then
305 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
306 GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
307 elif test "$GSSAPI_ROOT" != "yes"; then
308 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
312 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
314 AC_CHECK_HEADER(gss.h,
316 dnl found in the given dirs
317 AC_DEFINE([SHIBRESOLVER_HAVE_GSSGNU],[1],[if you have the GNU gssapi libraries])
321 dnl not found, check Heimdal or MIT
322 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
324 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
329 #ifdef HAVE_GSSAPI_GSSAPI_H
330 #include <gssapi/gssapi.h>
333 if test "x$not_mit" = "x1"; then
334 dnl MIT not found, check for Heimdal
335 AC_CHECK_HEADER([gssapi.h],
338 AC_DEFINE([SHIBRESOLVER_HAVE_GSSHEIMDAL],[1],[if you have the Heimdal gssapi libraries])
341 dnl no header found, disabling GSS
343 AC_MSG_WARN([disabling GSSAPI since no header files was found])
348 AC_DEFINE([SHIBRESOLVER_HAVE_GSSMIT],[1],[if you have the MIT gssapi libraries])
349 dnl check if we have a really old MIT kerberos (<= 1.2)
350 AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
353 #include <gssapi/gssapi.h>
354 #include <gssapi/gssapi_generic.h>
355 #include <gssapi/gssapi_krb5.h>
360 GSS_C_NT_HOSTBASED_SERVICE,
367 AC_DEFINE([HAVE_OLD_GSSMIT],[1],[if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
375 if test x"$want_gss" = xyes; then
376 AC_DEFINE([SHIBRESOLVER_HAVE_GSSAPI],[1],[if you have the gssapi libraries])
378 if test -n "$gnu_gss"; then
379 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
382 if test -z "$GSSAPI_LIB_DIR"; then
383 GSSAPI_LIB_DIR="$GSSAPI_ROOT/lib$libsuff"
385 if test "$GSSAPI_ROOT" != "yes"; then
386 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
388 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
389 dnl krb5-config does not have --libs-only-L or similar, put everything into LIBS
390 gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
392 if test "x$not_mit" = "x1"; then
395 gss_libs="-lgssapi_krb5"
398 LIBS="$LIBS $gss_libs"
401 AC_MSG_CHECKING([whether GSS-API naming extensions are available])
404 #ifdef SHIBRESOLVER_HAVE_GSSGNU
406 #elif defined SHIBRESOLVER_HAVE_GSSMIT
407 # include <gssapi/gssapi.h>
408 # include <gssapi/gssapi_ext.h>
412 [[gss_get_name_attribute(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);]])],
413 [AC_MSG_RESULT([yes])AC_DEFINE([SHIBRESOLVER_HAVE_GSSAPI_NAMINGEXTS],[1],[Define to 1 if GSS-API naming extensions are available.])],
414 [AC_MSG_RESULT([no])])
417 CPPFLAGS="$save_CPPFLAGS"
422 AC_SUBST(XMLSEC_LIBS)
424 LIBTOOL="$LIBTOOL --silent"