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