Add boost support, and header fix
[shibboleth/cpp-sp.git] / configure.ac
1 AC_PREREQ([2.50])
2 AC_INIT([shibboleth],[2.5],[https://issues.shibboleth.net/],[shibboleth])
3 AC_CONFIG_SRCDIR(shibsp)
4 AC_CONFIG_AUX_DIR(build-aux)
5 AC_CONFIG_MACRO_DIR(m4)
6 AM_INIT_AUTOMAKE
7 AC_DISABLE_STATIC
8 AC_PROG_LIBTOOL
9
10 # Docygen features
11 DX_HTML_FEATURE(ON)
12 DX_CHM_FEATURE(OFF)
13 DX_CHI_FEATURE(OFF)
14 DX_MAN_FEATURE(OFF)
15 DX_RTF_FEATURE(OFF)
16 DX_XML_FEATURE(OFF)
17 DX_PDF_FEATURE(OFF)
18 DX_PS_FEATURE(OFF)
19 DX_INIT_DOXYGEN(shibboleth, doxygen.cfg, doc/api)
20 DX_INCLUDE=
21
22 AC_ARG_ENABLE(debug,
23     AS_HELP_STRING([--enable-debug],[Have GCC compile with symbols (Default = no)]),
24     enable_debug=$enableval, enable_debug=no)
25
26 if test "$enable_debug" = "yes" ; then
27     GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
28     GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
29 else
30     GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
31     GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
32 fi
33
34 AC_CONFIG_HEADERS([config.h shibsp/config_pub.h])
35 AC_CONFIG_FILES([shibboleth.spec])
36
37 AC_PROG_CC([gcc gcc3 cc])
38 AC_PROG_CXX([g++ g++3 c++ CC])
39 AC_CANONICAL_HOST
40
41 if test "$GCC" = "yes" ; then
42 #    AC_HAVE_GCC_VERSION(4,0,0,0,
43 #        [
44 #        AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
45 #            [Define to enable class visibility control in gcc.])
46 #        GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
47 #        GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
48 #        ])
49     CFLAGS="-Wall $GCC_CFLAGS"
50     CXXFLAGS="-Wall $GCC_CXXFLAGS"
51 fi
52
53 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
54 # Also enables POSIX semantics for some functions.
55 case "${host_cpu}-${host_os}" in
56     *solaris*)
57         CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
58         CXXFLAGS="$CXXFLAGS -D_POSIX_PTHREAD_SEMANTICS"
59         if test "$CXX" = "CC" ; then
60                 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
61         fi
62     ;;
63         *osf*)
64         CXXFLAGS="$CXXFLAGS -D_POSIX_PII_SOCKET"
65         ;;
66 esac
67
68 AC_LANG(C)
69
70 # Checks for typedefs, structures, and compiler characteristics.
71 AC_C_CONST
72 AC_TYPE_SIZE_T
73 AC_STRUCT_TM
74
75 # Checks for library functions.
76 AC_FUNC_STRFTIME
77 AC_FUNC_STRERROR_R
78 AC_CHECK_HEADERS([sys/utsname.h grp.h pwd.h])
79 AC_CHECK_HEADERS([sys/socket.h], [AC_DEFINE([SHIBSP_HAVE_SYS_SOCKET_H],[1],[Define to 1 if you have the <sys/socket> header file.])], [])
80 AC_CHECK_FUNCS([strchr strdup strstr timegm gmtime_r strtok_r strcasecmp getpwnam getgrnam])
81 AC_CHECK_TYPES([struct sockaddr_storage], [], [], [[#include <sys/socket.h>]])
82
83 # checks for pthreads
84 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
85 if test $enable_threads != "pthread"; then
86     AC_MSG_ERROR([unable to find pthreads, currently this is required])
87 else
88     AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])
89     LIBS="$PTHREAD_LIBS $LIBS"
90     CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
91     CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
92 fi
93
94 # OpenSSL settings
95 AC_ARG_WITH(openssl,
96     AS_HELP_STRING([--with-openssl=PATH],[where openssl is installed]),
97     [if test x_$with_openssl != x_/usr; then
98         SSLFLAGS="-I${with_openssl}/include"
99     fi])
100
101 if test "x$with_openssl" = "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`"
106         else
107             AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
108         fi
109     fi
110 fi
111
112 AC_MSG_CHECKING(for OpenSSL cflags)
113 AC_MSG_RESULT($SSLFLAGS)
114 CPPFLAGS="$SSLFLAGS $CPPFLAGS"
115
116 AC_CHECK_HEADER([openssl/x509.h],,AC_MSG_ERROR([unable to find openssl header files]))
117
118 AC_LANG([C++])
119
120 # C++ requirements
121 AC_CXX_NAMESPACES
122 AC_CXX_REQUIRE_STL
123
124 # Boost
125 BOOST_REQUIRE
126 BOOST_BIND
127 BOOST_LAMBDA
128 BOOST_PTR_CONTAINER
129 BOOST_STRING_ALGO
130 CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
131
132 # Thank you Solaris, really.
133 AC_MSG_CHECKING(for ctime_r)
134 if test -z "$ac_cv_ctime_args"; then
135     AC_COMPILE_IFELSE(
136         [AC_LANG_PROGRAM([[#include <time.h>]], [[time_t clock; char buf[26]; ctime_r(&clock, buf);]])],
137         [ac_cv_ctime_args=2],[])
138
139     AC_COMPILE_IFELSE(
140         [AC_LANG_PROGRAM([[#include <time.h>]], [[time_t clock; char buf[26]; ctime_r(&clock, buf, 26);]])],
141         [ac_cv_ctime_args=3],[])
142 fi
143 if test -z "$ac_cv_ctime_args"; then
144     AC_MSG_RESULT(no)
145 else
146     if test "$ac_cv_ctime_args" = 2; then
147         AC_DEFINE([HAVE_CTIME_R_2],[1],[Define if ctime_r is present with 2 parameters.])
148     elif test "$ac_cv_ctime_args" = 3; then
149         AC_DEFINE([HAVE_CTIME_R_3],[1],[Define if ctime_r is present with 3 parameters.])
150     fi
151     AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
152 fi 
153
154 # log4shib settings (favor this version over the log4cpp code)
155 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
156 AC_ARG_WITH(log4shib,
157     AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
158     [
159     LOG4SHIB_CONFIG="${with_log4shib}"
160     if ! test -f "${LOG4SHIB_CONFIG}"; then
161         LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
162     fi
163     ])
164 if test -f "${LOG4SHIB_CONFIG}" ; then
165     LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
166     CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
167     AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
168     AC_LINK_IFELSE(
169         [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
170 #include <log4shib/CategoryStream.hh>]],
171             [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
172         [AC_DEFINE([SHIBSP_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
173         [AC_MSG_ERROR([unable to link with log4shib])])
174 else
175     AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
176     AC_MSG_WARN([will look for original log4cpp library])
177     
178     # log4cpp settings
179     AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
180     AC_ARG_WITH(log4cpp,
181         AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
182         [
183         LOG4CPP_CONFIG="${with_log4cpp}"
184         if ! test -f "${LOG4CPP_CONFIG}"; then
185             LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
186         fi
187         ])
188     if test -f "${LOG4CPP_CONFIG}"; then
189         AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
190         LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
191         CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
192         AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
193         AC_LINK_IFELSE(
194             [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
195 #include <log4cpp/CategoryStream.hh>]],
196                 [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
197             [AC_DEFINE([SHIBSP_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
198             [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
199     else
200         AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
201     fi
202 fi
203
204 # Xerces settings
205 AC_ARG_WITH(xerces,
206     AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),,
207     [with_xerces=/usr])
208 if test x_$with_xerces != x_/usr; then
209     CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
210     LIBS="-L${with_xerces}/lib -lxerces-c $LIBS"
211 else
212     LIBS="-lxerces-c $LIBS"
213 fi
214
215 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
216 AC_MSG_CHECKING([Xerces version])
217 AC_PREPROC_IFELSE(
218     [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
219 [#if  _XERCES_VERSION >= 20700
220 int i = 0;
221 #else
222 #error version 2.7.0 or above required
223 #endif])],
224     [AC_MSG_RESULT(OK)],
225     [AC_MSG_FAILURE([Xerces-C v2.7.0 or higher is required, v3.x preferred])])
226 AC_LINK_IFELSE(
227     [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],[[xercesc::XMLPlatformUtils::Initialize()]])],
228     ,[AC_MSG_ERROR([unable to link with Xerces])])
229
230 AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
231 AC_COMPILE_IFELSE(
232     [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
233     [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
234     [AC_MSG_RESULT([yes])AC_DEFINE([SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
235     [AC_MSG_RESULT([no])])
236
237 AC_MSG_CHECKING([whether Xerces DOMNodeFilter API returns a short])
238 AC_COMPILE_IFELSE(
239     [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
240         [[using namespace XERCES_CPP_NAMESPACE;
241       class Blocker : public DOMNodeFilter {
242       public:
243         short acceptNode(const DOMNode* node) const {
244             return FILTER_REJECT;
245         }
246       };
247       static Blocker g_Blocker;
248     ]])],
249     [AC_MSG_RESULT([yes])AC_DEFINE([SHIBSP_XERCESC_SHORT_ACCEPTNODE],[1],[Define to 1 if Xerces DOMNodeFilter API returns a short.])],
250     [AC_MSG_RESULT([no])])
251
252 # XML-Security settings
253 AC_ARG_WITH(xmlsec,
254     AS_HELP_STRING([--with-xmlsec=PATH],[where xmlsec is installed]),,
255     [with_xmlsec=/usr])
256 if test x_$with_xmlsec != x_/usr; then
257     CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
258     XMLSEC_LIBS="-L${with_xmlsec}/lib -lxml-security-c $XMLSEC_LIBS"
259 else
260     XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
261 fi
262
263 # save and append master libs
264 save_LIBS="$LIBS"
265 LIBS="$XMLSEC_LIBS $LIBS"
266
267 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security-C header files]))
268 AC_MSG_CHECKING([XML-Security-C version])
269 AC_PREPROC_IFELSE(
270     [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
271     [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
272 int i = 0;
273 #else
274 #error need version 1.4.0 or later
275 #endif])],
276     [AC_MSG_RESULT(OK)],
277     [AC_MSG_FAILURE([XML-Security-C version 1.4.0 or greater is required.])])
278 AC_LINK_IFELSE(
279     [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
280         [[XSECPlatformUtils::Initialise()]])],,
281     [AC_MSG_ERROR([unable to link with XML-Security])])
282
283 AC_MSG_CHECKING([whether XML-Security-C supports white/blacklisting of algorithms])
284 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <xsec/framework/XSECAlgorithmMapper.hpp>]], [[XSECAlgorithmMapper* mapper; mapper->whitelistAlgorithm(NULL);]])],[AC_MSG_RESULT([yes])
285       AC_DEFINE([SHIBSP_XMLSEC_WHITELISTING],[1],[Define to 1 if XML-Security-C supports white/blacklisting algorithms.])],[AC_MSG_RESULT([no])])
286
287 # restore master libs
288 LIBS="$save_LIBS"
289
290 #XML-Tooling settings
291 AC_ARG_WITH(xmltooling,
292     AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling is installed]),,
293     [with_xmltooling=/usr])
294 if test x_$with_xmltooling != x_/usr; then
295     CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
296     DX_INCLUDE="${with_xmltooling}/include"
297     LITE_LIBS="-L${with_xmltooling}/lib -lxmltooling-lite"
298     XMLSEC_LIBS="-L${with_xmltooling}/lib -lxmltooling $XMLSEC_LIBS"
299 else
300     LITE_LIBS="-lxmltooling-lite"
301     XMLSEC_LIBS="-lxmltooling $XMLSEC_LIBS"
302 fi
303
304 AC_CHECK_HEADER([xmltooling/base.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
305
306 # save and append master libs
307 save_LIBS="$LIBS"
308 LIBS="$XMLSEC_LIBS $LIBS"
309
310 AC_LINK_IFELSE(
311     [AC_LANG_PROGRAM([[#include <xmltooling/XMLToolingConfig.h>
312 #include <xmltooling/version.h>]],
313         [[#if _XMLTOOLING_VERSION >= 10500
314 xmltooling::XMLToolingConfig::getConfig();
315 #else
316 #error Need XMLTooling version 1.5 or higher
317 #endif]])],
318     ,[AC_MSG_ERROR([unable to link with XMLTooling, or version was too old])])
319
320 # restore master libs
321 LIBS="$save_LIBS"
322
323 # Establish location of xmltooling catalog.
324 XMLTOOLINGXMLDIR=""
325 if test "x$with_xmltooling" = "x" ; then
326    with_xmltooling="/usr"
327 fi
328 if test -f $with_xmltooling/share/xml/xmltooling/catalog.xml ; then
329     XMLTOOLINGXMLDIR="$with_xmltooling"
330 elif test -f $with_xerces/share/xml/xmltooling/catalog.xml ; then
331     XMLTOOLINGXMLDIR="$with_xerces"
332 elif test -f $with_log4shib/share/xml/xmltooling/catalog.xml ; then
333     XMLTOOLINGXMLDIR="$with_log4shib"
334 fi
335 if test "x$XMLTOOLINGXMLDIR" = "x" ; then
336     AC_MSG_ERROR([xmltooling XML catalog not found, may need to use --with-xmltooling option])
337 fi
338 XMLTOOLINGXMLDIR="$XMLTOOLINGXMLDIR/share/xml/xmltooling"
339 AC_SUBST(XMLTOOLINGXMLDIR)
340
341 # OpenSAML settings
342 AC_ARG_WITH(saml,
343     AS_HELP_STRING([--with-saml=PATH],[where opensaml is installed]),,
344     [with_saml=/usr])
345 if test x_$with_xmltooling != x_/usr; then
346     CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
347     DX_INCLUDE="$DX_INCLUDE ${with_saml}/include"
348     XMLSEC_LIBS="-L${with_saml}/lib -lsaml $XMLSEC_LIBS"
349 else
350     XMLSEC_LIBS="-lsaml $XMLSEC_LIBS"
351 fi
352
353 # save and append master libs
354 save_LIBS="$LIBS"
355 LIBS="$XMLSEC_LIBS $LIBS"
356
357 AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],,AC_MSG_ERROR([unable to find OpenSAML header files]))
358 AC_LINK_IFELSE(
359     [AC_LANG_PROGRAM([[#include <saml/SAMLConfig.h>
360 #include <saml/version.h>]],
361 [[#if _OPENSAML_VERSION >= 20500
362 opensaml::SAMLConfig::getConfig();
363 #else
364 #error Need OpenSAML version 2.5 or higher
365 #endif]])],
366     ,[AC_MSG_ERROR([unable to link with OpenSAML, or version was too old])
367         ])
368
369 # restore master libs
370 LIBS="$save_LIBS"
371
372 # Establish location of opensaml catalogs.
373 OPENSAMLXMLDIR=""
374 if test "x$with_saml" = "x" ; then
375     with_saml="/usr"
376 fi
377 if test -f $with_saml/share/xml/opensaml/saml20-catalog.xml ; then
378     OPENSAMLXMLDIR="$with_saml"
379 elif test -f $with_xmltooling/share/xml/opensaml/saml20-catalog.xml ; then
380     OPENSAMLXMLDIR="$with_xmltooling"
381 elif test -f $with_xerces/share/xml/opensaml/saml20-catalog.xml ; then
382     OPENSAMLXMLDIR="$with_xerces"
383 elif test -f $with_log4shib/share/xml/opensaml/saml20-catalog.xml ; then
384     OPENSAMLXMLDIR="$with_log4shib"
385 fi
386 if test "x$OPENSAMLXMLDIR" = "x" ; then
387     AC_MSG_ERROR([opensaml XML catalogs not found, may need to use --with-saml option])
388 fi
389 OPENSAMLXMLDIR="$OPENSAMLXMLDIR/share/xml/opensaml"
390 AC_SUBST(OPENSAMLXMLDIR)
391
392 AC_SUBST(LITE_LIBS)
393 AC_SUBST(XMLSEC_LIBS)
394
395 # output the underlying makefiles
396 WANT_SUBDIRS="doc schemas configs shibsp plugins shibd util"
397 AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
398         configs/Makefile shibsp/Makefile plugins/Makefile \
399         shibd/Makefile util/Makefile selinux/Makefile])
400
401 ## ADFS?
402 AC_CONFIG_FILES([adfs/Makefile])
403 AC_ARG_ENABLE([adfs],
404     AS_HELP_STRING([--disable-adfs],[don't build the ADFS module]),
405     [adfs_enabled=$enableval], [adfs_enabled=yes])
406 if test "x$adfs_enabled" = "x" ; then
407     adfs_enabled=yes
408 fi
409 AC_MSG_CHECKING(whether to build the ADFS module)
410 if test "$adfs_enabled" = "no" ; then
411     AC_MSG_RESULT(no)
412 else
413     AC_MSG_RESULT(yes)
414     WANT_SUBDIRS="$WANT_SUBDIRS adfs"
415 fi
416
417
418 #
419 # Build NSAPI module?
420 #
421 AC_MSG_CHECKING(for NSAPI module option)
422 AC_ARG_WITH(nsapi,
423     AS_HELP_STRING([--with-nsapi=DIR],[Build NSAPI module for Netscape/iPlanet/SunONE]),
424     [WANT_NSAPI=$withval],[WANT_NSAPI=no])
425 AC_MSG_RESULT($WANT_NSAPI)
426
427 if test "$WANT_NSAPI" != "no"; then
428   if test ! -d $WANT_NSAPI/bin ; then
429     AC_MSG_ERROR([Please specify the path to the root of your Netscape/iPlanet/SunONE server using --with-nsapi=DIR])
430   fi
431   AC_MSG_CHECKING(for NSAPI include files)
432   if test -d $WANT_NSAPI/include ; then
433     NSAPI_INCLUDE=$WANT_NSAPI/include
434     AC_MSG_RESULT(Netscape-Enterprise 3.x style)
435     AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h],,,[#define XP_UNIX])
436     NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
437   fi
438   if test -d $WANT_NSAPI/plugins/include ; then
439     test -n "$NSAPI_INCLUDE" && NSAPI_INC_DIR="-I$NSAPI_INCLUDE"
440     NSAPI_INCLUDE="$WANT_NSAPI/plugins/include"
441     AC_MSG_RESULT(iPlanet 4.x / SunONE 6.x style)
442     AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h],,,[#define XP_UNIX])
443     NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
444   fi
445   if test "$NSAPI_INCLUDE" = ""; then
446     AC_MSG_ERROR([Please check you have nsapi.h in either $WANT_NSAPI/include or $WANT_NSAPI/plugins/include])
447   fi
448 fi
449
450 AC_SUBST(NSAPI_INCLUDE)
451
452 # always output the Makefile, even if you don't use it
453 AC_CONFIG_FILES([nsapi_shib/Makefile])
454 AM_CONDITIONAL(BUILD_NSAPI,test ! "$WANT_NSAPI" = "no")
455
456 # add the NSAPI module to the list of wanted subdirs..
457 if test ! "$WANT_NSAPI" = "no" ; then
458     WANT_SUBDIRS="$WANT_SUBDIRS nsapi_shib"
459 fi
460
461
462 #
463 # Build FastCGI support?
464 #
465 AC_MSG_CHECKING(for FastCGI support)
466 AC_ARG_WITH(fastcgi,
467     AS_HELP_STRING([--with-fastcgi=DIR],[Build FastCGI support]),
468     [WANT_FASTCGI=$withval],[WANT_FASTCGI=no])
469 AC_MSG_RESULT($WANT_FASTCGI)
470
471 if test "$WANT_FASTCGI" != "no"; then
472     if test "$WANT_FASTCGI" != "yes"; then
473         if test x_$WANT_FASTCGI != x_/usr; then
474             FASTCGI_INCLUDE="-I$WANT_FASTCGI/include"
475             FASTCGI_LDFLAGS="-L$WANT_FASTCGI/lib"
476         fi
477     fi
478     AC_CHECK_HEADER([fcgio.h],,AC_MSG_ERROR([unable to find FastCGI header files]))
479     FASTCGI_LIBS="-lfcgi -lfcgi++"
480 fi
481
482 AC_SUBST(FASTCGI_INCLUDE)
483 AC_SUBST(FASTCGI_LDFLAGS)
484 AC_SUBST(FASTCGI_LIBS)
485
486 # always output the Makefile, even if you don't use it
487 AC_CONFIG_FILES([fastcgi/Makefile])
488 AM_CONDITIONAL(BUILD_FASTCGI,test ! "$WANT_FASTCGI" = "no")
489
490 if test ! "$WANT_FASTCGI" = "no" ; then
491     WANT_SUBDIRS="$WANT_SUBDIRS fastcgi"
492 fi
493
494 #
495 # Build Memcached support?
496 #
497 AC_MSG_CHECKING(for Memcached support)
498 AC_ARG_WITH(memcached,
499     AS_HELP_STRING([--with-memcached=DIR],[Build Memcached support]),
500     [WANT_MEMCACHED=$withval],[WANT_MEMCACHED=no])
501 AC_MSG_RESULT($WANT_MEMCACHED)
502
503 if test "$WANT_MEMCACHED" != "no"; then
504     if test "$WANT_MEMCACHED" != "yes"; then
505         if test x_$WANT_MEMCACHED != x_/usr; then
506             MEMCACHED_INCLUDE="-I$WANT_MEMCACHED/include"
507             MEMCACHED_LDFLAGS="-L$WANT_MEMCACHED/lib"
508         fi
509     fi
510     AC_CHECK_HEADER([libmemcached/memcached.h],,
511         AC_MSG_ERROR([unable to find Memcached header files]))
512     MEMCACHED_LIBS="-lmemcached"
513 fi
514
515 AC_SUBST(MEMCACHED_INCLUDE)
516 AC_SUBST(MEMCACHED_LDFLAGS)
517 AC_SUBST(MEMCACHED_LIBS)
518
519 # always output the Makefile, even if you don't use it
520 AC_CONFIG_FILES([memcache-store/Makefile])
521 AM_CONDITIONAL(BUILD_MEMCACHED,test ! "$WANT_MEMCACHED" = "no")
522
523 if test ! "$WANT_MEMCACHED" = "no" ; then
524     WANT_SUBDIRS="$WANT_SUBDIRS memcache-store"
525 fi
526
527
528 #
529 # If no --enable-apache-xx specified 
530 # find a default and fake the specific parameters
531 #
532
533 # simple macro to peek at an enable or a with
534 AC_DEFUN([Peek],
535 if test "[${[$1]_][$2]+set}" = set; then
536   peekval="${[$1]_[$2]}"
537   $3
538 fi; dnl
539 )
540
541 AC_MSG_CHECKING(if default apache needed)
542 need_default=yes
543 Peek(enable,apache_13,need_default=no)
544 Peek(enable,apache_20,need_default=no)
545 Peek(enable,apache_22,need_default=no)
546 AC_MSG_RESULT($need_default)
547
548 if test "$need_default" = "yes"; then
549   # find an apxs, then the httpd
550   xs=
551   Peek(with,apxs,xs="$peekval")
552   Peek(with,apxs2,xs="$peekval")
553   Peek(with,apxs22,xs="$peekval")
554   if test "x$xs" = "x"; then
555      AC_PATH_PROGS(xs, apxs2 apxs,
556         AC_MSG_ERROR(No apxs, no apache found.  Try --with-apxs),
557         [/usr/local/apache2/bin:/usr/local/apache/bin:/usr/sbin:$PATH])
558   fi
559   # ask the daemon for the version and set parameters
560   AC_MSG_CHECKING(default apache version)
561   httpd="`$xs -q SBINDIR`/`$xs -q TARGET`"
562   if test "x$httpd" != "x" && test -f $httpd ; then
563      v=`$httpd -v|$SED -n -e 's/.*Apache\/\.*//p'`
564      case $v in
565        1.3*)   [enable_apache_13]=yes
566                [with_apxs]=$xs
567                AC_MSG_RESULT(1.3)
568                ;;
569        2.0*)   [enable_apache_20]=yes
570                [with_apxs2]=$xs
571                AC_MSG_RESULT(2.0)
572                ;;
573        2.2*)   [enable_apache_22]=yes
574                [with_apxs22]=$xs
575                AC_MSG_RESULT(2.2)
576                ;;
577        *)      AC_MSG_ERROR(unusable apache versions: $v. Try setting --with-apxs)
578      esac
579   else 
580      AC_MSG_RESULT(cannot determine version.  Try setting --with-apxs)
581   fi
582 fi
583
584 # Apache 1.3 (mod_shib_13)
585 #   --enable-apache-13
586 #   --with-apxs      (DSO build, the normal way, uses apxs to derive build flags)
587
588 AC_ARG_ENABLE(apache-13,
589         AS_HELP_STRING([--enable-apache-13],[enable the Apache 1.3 module]),
590         [if test "x$enableval" = "x" ; then
591          WANT_APACHE_13=yes
592          else
593              WANT_APACHE_13="$enableval"
594          fi
595         ],[ WANT_APACHE_13=no ])
596 AC_MSG_CHECKING(whether to build Apache 1.3 module)
597 if test "$WANT_APACHE_13" != yes && test "$WANT_APACHE_13" != no ; then
598    WANT_APACHE_13=yes
599 fi
600 AC_MSG_RESULT($WANT_APACHE_13)
601
602 if test "$WANT_APACHE_13" = "yes" ; then
603     AC_ARG_WITH(apxs, 
604         AS_HELP_STRING([--with-apxs=FILE],[Specifies where to find the Apache 1.3 apxs script.]),
605         [
606         AC_MSG_CHECKING(for user-specified apxs name/location)
607         if test "$withval" != "no" ; then
608           if test "$withval" != "yes"; then
609             APXS=$withval
610             AC_MSG_RESULT("$withval")
611           fi
612         fi
613         ],
614         [
615         AC_PATH_PROG(APXS, apxs, no)
616         if test "$APXS" = "no" ; then
617           for i in /usr/sbin /usr/local/apache/bin ; do
618             if test "$APXS" = "no" && test -f "$i/apxs"; then
619               APXS="$i/apxs"
620             fi
621           done
622         fi
623         ])
624
625     AC_MSG_CHECKING([to see if apxs was located])
626     if test ! -f "$APXS" ; then
627         AC_MSG_RESULT(no)
628         AC_MSG_ERROR([Unable to locate apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs option.])
629     fi
630     AC_MSG_RESULT($APXS)
631     AC_SUBST(APXS)
632
633     # extract settings we need from APXS -q
634     APXS_CC="`$APXS -q CC`"
635     APXS_CFLAGS="`$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
636     APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
637 fi
638
639 AC_SUBST(APXS_CFLAGS)
640 AC_SUBST(APXS_INCLUDE)
641
642
643 # Apache 2.0 (mod_shib_20)
644 #   --enable-apache-20
645 #   --with-apxs2      (DSO build, the normal way, uses apxs to derive build flags)
646 #       --with-apr        (DSO build, APR development package installed separately)
647 #   --with-apu        (DSO build, APR-UTIL development package installed separately)
648
649 AC_ARG_ENABLE(apache-20,
650         AS_HELP_STRING([--enable-apache-20],[enable the Apache 2.0 module]),
651         [if test "x$enableval" = "x" ; then
652          WANT_APACHE_20=yes
653          else
654              WANT_APACHE_20="$enableval"
655          fi
656         ],[ WANT_APACHE_20=no ])
657 AC_MSG_CHECKING(whether to build Apache 2.0 module)
658 if test "$WANT_APACHE_20" != yes && test "$WANT_APACHE_20" != no ; then
659     WANT_APACHE_20=yes
660 fi
661 AC_MSG_RESULT($WANT_APACHE_20)
662
663 if test "$WANT_APACHE_20" = "yes" ; then
664     AC_ARG_WITH(apxs2, 
665         AS_HELP_STRING([--with-apxs2=FILE],[Specifies where to find the Apache 2.0 apxs script.]),
666         [
667         AC_MSG_CHECKING(for user-specified Apache2 apxs name/location)
668         if test "$withval" != "no" ; then
669           if test "$withval" != "yes"; then
670             APXS2=$withval
671             AC_MSG_RESULT("$withval")
672           fi
673         fi
674         ],
675         [
676         AC_PATH_PROG(APXS2, apxs2, no)
677         if test "$APXS2" = "no" ; then
678             AC_PATH_PROG(APXS2, apxs, no)
679         fi
680         if test "$APXS2" = "no" ; then
681           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
682             if test "$APXS2" = "no" && test -f "$i/apxs2" ; then
683               APXS2="$i/apxs2"
684             fi
685           done
686           if test "$APXS2" = "no" ; then
687             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
688               if test "$APXS2" = "no" && test -f "$i/apxs" ; then
689                 APXS2="$i/apxs"
690               fi
691             done
692           fi
693         fi
694         ])
695
696     AC_MSG_CHECKING([to see if Apache2 apxs was located])
697     if test ! -f "$APXS2" ; then
698         AC_MSG_RESULT(no)
699         AC_MSG_ERROR([Unable to locate Apache2 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs2 option.])
700     fi
701     AC_MSG_RESULT($APXS2)
702     AC_SUBST(APXS2)
703
704     # APR settings
705     AC_ARG_WITH(apr, 
706         AS_HELP_STRING([--with-apr=PATH],[where apr-config is installed]),
707         [
708         AC_MSG_CHECKING(for user-specified apr-config name/location)
709         if test "$withval" != "no" ; then
710             if test "$withval" != "yes"; then
711                 APR_CONFIG=$withval
712                 AC_MSG_RESULT("$withval")
713             fi
714         fi
715         ],
716         [
717         AC_PATH_PROG(APR_CONFIG, apr-config,,[`$APXS2 -q SBINDIR`]:[$PATH])
718         ])
719         if test -f "${APR_CONFIG}"; then
720         APR_CFLAGS="`${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags` `${APR_CONFIG} --includes`"
721     else
722         AC_MSG_ERROR([Unable to locate apr-config, may need --with-apr option.])
723     fi
724
725     # APU settings
726     AC_ARG_WITH(apu, 
727         AS_HELP_STRING([--with-apu=PATH],[where apu-config is installed]),
728         [
729         AC_MSG_CHECKING(for user-specified apu-config name/location)
730         if test "$withval" != "no" ; then
731             if test "$withval" != "yes"; then
732                 APR_CONFIG=$withval
733                 AC_MSG_RESULT("$withval")
734             fi
735         fi
736         ],
737         [
738         AC_PATH_PROG(APU_CONFIG, apu-config,,[`$APXS2 -q SBINDIR`]:[$PATH])
739         ])
740     if test -f "${APU_CONFIG}"; then
741         APU_CFLAGS="`${APU_CONFIG} --includes`"
742     else
743         AC_MSG_ERROR([Unable to locate apu-config, may need --with-apu option.])
744     fi
745
746     # extract settings we need from APXS2 -q
747     APXS2_CC="`$APXS2 -q CC`"
748     APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` $APR_CFLAGS $APU_CFLAGS"
749     APXS2_INCLUDE="`$APXS2 -q INCLUDEDIR`"
750 fi
751
752 AC_SUBST(APXS2_CFLAGS)
753 AC_SUBST(APXS2_INCLUDE)
754
755
756 # Apache 2.2 (mod_shib_22)
757 #   --enable-apache-22
758 #   --with-apxs22     (DSO build, the normal way, uses apxs to derive build flags)
759 #       --with-apr1       (DSO build, APR development package installed separately)
760 #   --with-apu1       (DSO build, APR-UTIL development package installed separately)
761
762 AC_ARG_ENABLE(apache-22,
763         AS_HELP_STRING([--enable-apache-22],[enable the Apache 2.2 module]),
764         [if test "x$enableval" = "x" ; then
765          WANT_APACHE_22=yes
766          else
767              WANT_APACHE_22="$enableval"
768          fi
769         ],[ WANT_APACHE_22=no ])
770 AC_MSG_CHECKING(whether to build Apache 2.2 module)
771 if test "$WANT_APACHE_22" != yes && test "$WANT_APACHE_22" != no ; then
772     WANT_APACHE_22=yes
773 fi
774 AC_MSG_RESULT($WANT_APACHE_22)
775
776 if test "$WANT_APACHE_22" = "yes" ; then
777     AC_ARG_WITH(apxs22, 
778         AS_HELP_STRING([--with-apxs22=FILE],[Specifies where to find the Apache 2.2 apxs script.]),
779         [
780         AC_MSG_CHECKING(for user-specified Apache2.2 apxs name/location)
781         if test "$withval" != "no" ; then
782           if test "$withval" != "yes"; then
783             APXS22=$withval
784             AC_MSG_RESULT("$withval")
785           fi
786         fi
787         ],
788         [
789         AC_PATH_PROG(APXS22, apxs2, no)
790         if test "$APXS22" = "no" ; then
791             AC_PATH_PROG(APXS22, apxs, no)
792         fi
793         if test "$APXS22" = "no" ; then
794           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
795             if test "$APXS22" = "no" && test -f "$i/apxs2" ; then
796               APXS22="$i/apxs2"
797             fi
798           done
799           if test "$APXS22" = "no" ; then
800             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
801               if test "$APXS22" = "no" && test -f "$i/apxs" ; then
802                 APXS22="$i/apxs"
803               fi
804             done
805           fi
806         fi
807         ])
808
809     AC_MSG_CHECKING([to see if Apache2.2 apxs was located])
810     if test ! -f "$APXS22" ; then
811         AC_MSG_RESULT(no)
812         AC_MSG_ERROR([Unable to locate Apache2.2 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs22 option.])
813     fi
814     AC_MSG_RESULT($APXS22)
815     AC_SUBST(APXS22)
816
817     # APR1 settings
818     AC_ARG_WITH(apr1, 
819         AS_HELP_STRING([--with-apr1=PATH],[where apr-1-config is installed]),
820         [
821         AC_MSG_CHECKING(for user-specified apr-1-config name/location)
822         if test "$withval" != "no" ; then
823             if test "$withval" != "yes"; then
824                 APR1_CONFIG=$withval
825                 AC_MSG_RESULT("$withval")
826             fi
827         fi
828         ],
829         [
830         AC_PATH_PROG(APR1_CONFIG, apr-1-config,,[`$APXS22 -q SBINDIR`]:[$PATH])
831         ])
832         if test -f "${APR1_CONFIG}"; then
833         APR1_CFLAGS="`${APR1_CONFIG} --cflags` `${APR1_CONFIG} --cppflags` `${APR1_CONFIG} --includes`"
834     else
835         AC_MSG_ERROR([Unable to locate apr-1-config, may need --with-apr1 option.])
836     fi
837
838     # APU1 settings
839     AC_ARG_WITH(apu1, 
840         AS_HELP_STRING([--with-apu1=PATH],[where apu-1-config is installed]),
841         [
842         AC_MSG_CHECKING(for user-specified apu-1-config name/location)
843         if test "$withval" != "no" ; then
844             if test "$withval" != "yes"; then
845                 APU1_CONFIG=$withval
846                 AC_MSG_RESULT("$withval")
847             fi
848         fi
849         ],
850         [
851         AC_PATH_PROG(APU1_CONFIG, apu-1-config,,[`$APXS22 -q SBINDIR`]:[$PATH])
852         ])
853     if test -f "${APU1_CONFIG}"; then
854         APU1_CFLAGS="`${APU1_CONFIG} --includes`"
855     else
856         AC_MSG_ERROR([Unable to locate apu-1-config, may need --with-apu1 option.])
857     fi
858
859     # extract settings we need from APXS22 -q
860     APXS22_CC="`$APXS22 -q CC`"
861     APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` $APR1_CFLAGS $APU1_CFLAGS"
862     APXS22_INCLUDE="`$APXS22 -q INCLUDEDIR`"
863 fi
864
865 AC_SUBST(APXS22_CFLAGS)
866 AC_SUBST(APXS22_INCLUDE)
867
868 # always output the Makefile, even if you don't use it
869 AC_CONFIG_FILES([apache/Makefile])
870 AM_CONDITIONAL(BUILD_AP13,test "$WANT_APACHE_13" = "yes")
871 AM_CONDITIONAL(BUILD_AP20,test "$WANT_APACHE_20" = "yes")
872 AM_CONDITIONAL(BUILD_AP22,test "$WANT_APACHE_22" = "yes")
873
874 # add the apache module to the list of wanted subdirs..
875 if test "$WANT_APACHE_13" = "yes" || test "$WANT_APACHE_20" = "yes" || test "$WANT_APACHE_22" = "yes" ; then
876     WANT_SUBDIRS="$WANT_SUBDIRS apache"
877 fi
878
879
880 #
881 # Implement the checks of the ODBC Storage Service
882 #
883 # 1) Assume the user wants ODBC; if it's not found then just continue without
884 # 2) If the user specifically requested odbc, look for it and ERROR if not found
885 # 3) If the user specifically requested no odbc, don't build it.
886 #
887
888 AC_CONFIG_FILES([odbc-store/Makefile])
889
890 # determine whether we should enable the odbc ccache
891 AC_ARG_ENABLE([odbc],
892         AS_HELP_STRING([--disable-odbc],[disable the ODBC Storage Service]),
893         [odbc_enabled=$enableval], [odbc_enabled=default])
894 if test "x$odbc_enabled" = "x" ; then
895     odbc_enabled=yes
896 fi
897
898 # Are we trying to build ODBC?
899 AC_MSG_CHECKING(whether to build the ODBC storage service)
900 if test "$odbc_enabled" = "yes" ; then
901     build_odbc=yes
902     AC_MSG_RESULT(yes)
903 elif test "$odbc_enabled" = "default" ; then
904     build_odbc=yes
905     AC_MSG_RESULT([yes, if it can be found])
906 else
907     build_odbc=no
908     AC_MSG_RESULT(no)
909 fi
910
911 # If we're trying to build ODBC, try to find the odbc_config program.
912 if test "$build_odbc" = "yes" ; then
913     odbc_dir=""
914     AC_ARG_WITH(odbc,
915            AS_HELP_STRING([--with-odbc=PATH],[directory where odbc is installed]),
916             [if test "$with_odbc" = no ; then
917             AC_MSG_ERROR([Try running --disable-odbc instead.])
918          elif test "$with_odbc" != yes ; then
919             odbc_dir="$with_odbc/bin"
920             if test "$with_odbc" != /usr ; then
921                 ODBC_CFLAGS="-I$with_odbc/include"
922                 ODBC_LIBS="-L$with_odbc/lib"
923             fi
924          fi])
925
926    AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
927    if test "$ODBC_CONFIG" = no ; then
928       AC_MSG_WARN([Cannot find odbc_config, will try to guess settings.])
929       ODBC_LIBS="$ODBC_LIBS -lodbc"
930    else
931       ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
932       ODBC_LIBS=`$ODBC_CONFIG --libs`
933    fi
934
935    save_CPPFLAGS="$CPPFLAGS"
936    CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
937
938    AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
939    if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
940      AC_MSG_ERROR(unable to find ODBC header files)
941    fi
942
943    if test "$have_sql_h" = yes ; then
944       save_LIBS="$LIBS"
945       LIBS="$LIBS $ODBC_LIBS"
946       AC_MSG_CHECKING(if we can link againt ODBC)
947       AC_LINK_IFELSE(
948         [AC_LANG_PROGRAM([[#include <sql.h>
949  #include <sqlext.h>
950  #include <stdio.h>]],
951             [[SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)]])],
952         [have_odbc_libs=yes],[have_odbc_libs=no])
953       LIBS="$save_LIBS"
954       if test "$have_odbc_libs" = no ; then
955          if test "$odbc_enabled" = "yes" ; then
956             AC_MSG_ERROR([unable to link with ODBC Library])
957          else
958             AC_MSG_RESULT([no, skipping ODBC])
959          fi
960       fi
961    fi
962
963    CPPFLAGS="$save_CPPFLAGS"
964 fi
965
966 # if have_odbc_libs=yes then go ahead with building ODBC
967 if test "$have_odbc_libs" = yes ; then
968    # this AC_MSG_RESULT is from above!
969    AC_MSG_RESULT(yes)
970    WANT_SUBDIRS="$WANT_SUBDIRS odbc-store"
971    AC_SUBST(ODBC_CFLAGS)
972    AC_SUBST(ODBC_LIBS)
973 fi
974
975 # GSS-API checking
976
977 GSSAPI_ROOT="/usr"
978 AC_ARG_WITH(gssapi-includes,
979   AS_HELP_STRING([--with-gssapi-includes=DIR],[Specify location of GSSAPI header]),
980   [ GSSAPI_INCS="-I$withval"
981     want_gss="yes" ]
982 )
983
984 AC_ARG_WITH(gssapi-libs,
985   AS_HELP_STRING([--with-gssapi-libs=DIR],[Specify location of GSSAPI libs]),
986   [ GSSAPI_LIB_DIR="-L$withval"
987     want_gss="yes" ]
988 )
989
990 AC_ARG_WITH(gssapi,
991   AS_HELP_STRING([--with-gssapi=DIR],[Where to look for GSSAPI]),
992   [ GSSAPI_ROOT="$withval"
993   if test x"$GSSAPI_ROOT" != xno; then
994     want_gss="yes"
995     if test x"$GSSAPI_ROOT" = xyes; then
996       dnl if yes, then use default root
997       GSSAPI_ROOT="/usr"
998     fi
999   fi
1000 ])
1001
1002 save_CPPFLAGS="$CPPFLAGS"
1003 AC_MSG_CHECKING([if GSSAPI support is requested])
1004 if test x"$want_gss" = xyes; then
1005   AC_MSG_RESULT(yes)
1006
1007   if test -z "$GSSAPI_INCS"; then
1008      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1009         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
1010      elif test "$GSSAPI_ROOT" != "yes"; then
1011         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1012      fi
1013   fi
1014
1015   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1016
1017   AC_CHECK_HEADER(gss.h,
1018     [
1019       dnl found in the given dirs
1020       AC_DEFINE([SHIBSP_HAVE_GSSGNU],[1],[if you have the GNU gssapi libraries])
1021       gnu_gss=yes
1022     ],
1023     [
1024       dnl not found, check Heimdal or MIT
1025       AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1026       AC_CHECK_HEADERS(
1027         [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1028         [],
1029         [not_mit=1],
1030         [
1031 AC_INCLUDES_DEFAULT
1032 #ifdef HAVE_GSSAPI_GSSAPI_H
1033 #include <gssapi/gssapi.h>
1034 #endif
1035         ])
1036       if test "x$not_mit" = "x1"; then
1037         dnl MIT not found, check for Heimdal
1038         AC_CHECK_HEADER([gssapi.h],
1039             [
1040               dnl found
1041               AC_DEFINE([SHIBSP_HAVE_GSSHEIMDAL],[1],[if you have the Heimdal gssapi libraries])
1042             ],
1043             [
1044               dnl no header found, disabling GSS
1045               want_gss=no
1046               AC_MSG_WARN([disabling GSSAPI since no header files was found])
1047             ]
1048           )
1049       else
1050         dnl MIT found
1051         AC_DEFINE([SHIBSP_HAVE_GSSMIT],[1],[if you have the MIT gssapi libraries])
1052         dnl check if we have a really old MIT kerberos (<= 1.2)
1053         AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
1054         AC_COMPILE_IFELSE([
1055           AC_LANG_PROGRAM([[
1056 #include <gssapi/gssapi.h>
1057 #include <gssapi/gssapi_generic.h>
1058 #include <gssapi/gssapi_krb5.h>
1059           ]],[[
1060             gss_import_name(
1061                             (OM_uint32 *)0,
1062                             (gss_buffer_t)0,
1063                             GSS_C_NT_HOSTBASED_SERVICE,
1064                             (gss_name_t *)0);
1065           ]])
1066         ],[
1067           AC_MSG_RESULT([yes])
1068         ],[
1069           AC_MSG_RESULT([no])
1070           AC_DEFINE([HAVE_OLD_GSSMIT],[1],[if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
1071         ])
1072       fi
1073     ]
1074   )
1075 else
1076   AC_MSG_RESULT(no)
1077 fi
1078 if test x"$want_gss" = xyes; then
1079   AC_DEFINE([SHIBSP_HAVE_GSSAPI],[1],[if you have the gssapi libraries])
1080
1081   if test -n "$gnu_gss"; then
1082     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1083     LIBS="$LIBS -lgss"
1084   else
1085     if test -z "$GSSAPI_LIB_DIR"; then
1086       GSSAPI_LIB_DIR="$GSSAPI_ROOT/lib$libsuff"
1087     fi
1088     if test "$GSSAPI_ROOT" != "yes"; then
1089        LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1090     fi
1091     if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1092       dnl krb5-config doesn't have --libs-only-L or similar, put everything
1093       dnl into LIBS
1094       gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1095     else
1096       if test "x$not_mit" = "x1"; then
1097         gss_libs="-lgssapi"
1098       else
1099         gss_libs="-lgssapi_krb5"
1100       fi
1101     fi
1102     LIBS="$LIBS $gss_libs"
1103   fi
1104
1105   AC_MSG_CHECKING([whether GSS-API naming extensions are available])
1106   AC_COMPILE_IFELSE(
1107     [AC_LANG_PROGRAM([[
1108 #ifdef SHIBSP_HAVE_GSSGNU
1109 # include <gss.h>
1110 #elif defined SHIBSP_HAVE_GSSMIT
1111 # include <gssapi/gssapi.h>
1112 # include <gssapi/gssapi_ext.h>
1113 #else
1114 # include <gssapi.h>
1115 #endif]],
1116     [[gss_get_name_attribute(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);]])],
1117     [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_NAMINGEXTS],[1],[Define to 1 if GSS-API naming extensions are available.])],
1118     [AC_MSG_RESULT([no])])
1119
1120   AC_MSG_CHECKING([whether GSS-API composite name import is available])
1121   AC_COMPILE_IFELSE(
1122     [AC_LANG_PROGRAM([[
1123 #ifdef SHIBSP_HAVE_GSSGNU
1124 # include <gss.h>
1125 #elif defined SHIBSP_HAVE_GSSMIT
1126 # include <gssapi/gssapi.h>
1127 # include <gssapi/gssapi_ext.h>
1128 #else
1129 # include <gssapi.h>
1130 #endif]],
1131     [[
1132     OM_uint32 minor;
1133     gss_name_t srcname;
1134     gss_buffer_desc importbuf;
1135     gss_import_name(&minor, &importbuf, GSS_C_NT_EXPORT_NAME_COMPOSITE, &srcname);
1136     ]])],
1137     [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_COMPOSITE_NAME],[1],[Define to 1 if GSS-API composite name import is available.])],
1138     [AC_MSG_RESULT([no])])
1139     
1140 else
1141   CPPFLAGS="$save_CPPFLAGS"
1142 fi
1143
1144
1145 AC_SUBST(WANT_SUBDIRS)
1146
1147 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
1148   echo "=================================================================="
1149   echo "WARNING: You have chosen to compile Apache-1.3 modules with a different"
1150   echo "         compiler than the one used to compile Apache."
1151   echo ""
1152   echo "    Current compiler:      $CC"
1153   echo "   Apache's compiler:      $APXS_CC"
1154   echo ""
1155   echo "This could cause problems."
1156   echo "=================================================================="
1157 fi
1158
1159 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
1160   echo "=================================================================="
1161   echo "WARNING: You have chosen to compile Apache-2.0 modules with a different"
1162   echo "         compiler than the one used to compile Apache."
1163   echo ""
1164   echo "    Current compiler:      $CC"
1165   echo "   Apache's compiler:      $APXS2_CC"
1166   echo ""
1167   echo "This could cause problems."
1168   echo "=================================================================="
1169 fi
1170
1171 if test -n "$APXS22_CC" && test "$APXS22_CC" != "$CC" ; then
1172   echo "=================================================================="
1173   echo "WARNING: You have chosen to compile Apache-2.2 modules with a different"
1174   echo "         compiler than the one used to compile Apache."
1175   echo ""
1176   echo "    Current compiler:      $CC"
1177   echo "   Apache's compiler:      $APXS22_CC"
1178   echo ""
1179   echo "This could cause problems."
1180   echo "=================================================================="
1181 fi
1182
1183 LIBTOOL="$LIBTOOL --silent"
1184
1185 AC_OUTPUT