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