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