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