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