https://issues.shibboleth.net/jira/browse/SSPCPP-430
[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     AC_CHECK_DECL([memcached_last_error_message],
515         [AC_DEFINE([HAVE_MEMCACHED_LAST_ERROR_MESSAGE],[1],[Define to 1 if libmemcached supports error handling function.])],,
516         [#include <libmemcached/memcached.h>])
517     MEMCACHED_LIBS="-lmemcached"
518 fi
519
520 AC_SUBST(MEMCACHED_INCLUDE)
521 AC_SUBST(MEMCACHED_LDFLAGS)
522 AC_SUBST(MEMCACHED_LIBS)
523
524 # always output the Makefile, even if you don't use it
525 AC_CONFIG_FILES([memcache-store/Makefile])
526 AM_CONDITIONAL(BUILD_MEMCACHED,test ! "$WANT_MEMCACHED" = "no")
527
528 if test ! "$WANT_MEMCACHED" = "no" ; then
529     WANT_SUBDIRS="$WANT_SUBDIRS memcache-store"
530 fi
531
532
533 #
534 # If no --enable-apache-xx specified 
535 # find a default and fake the specific parameters
536 #
537
538 # simple macro to peek at an enable or a with
539 AC_DEFUN([Peek],
540 if test "[${[$1]_][$2]+set}" = set; then
541   peekval="${[$1]_[$2]}"
542   $3
543 fi; dnl
544 )
545
546 AC_MSG_CHECKING(if default apache needed)
547 need_default=yes
548 Peek(enable,apache_13,need_default=no)
549 Peek(enable,apache_20,need_default=no)
550 Peek(enable,apache_22,need_default=no)
551 AC_MSG_RESULT($need_default)
552
553 if test "$need_default" = "yes"; then
554   # find an apxs, then the httpd
555   xs=
556   Peek(with,apxs,xs="$peekval")
557   Peek(with,apxs2,xs="$peekval")
558   Peek(with,apxs22,xs="$peekval")
559   if test "x$xs" = "x"; then
560      AC_PATH_PROGS(xs, apxs2 apxs,
561         AC_MSG_ERROR(No apxs, no apache found.  Try --with-apxs),
562         [/usr/local/apache2/bin:/usr/local/apache/bin:/usr/sbin:$PATH])
563   fi
564   # ask the daemon for the version and set parameters
565   AC_MSG_CHECKING(default apache version)
566   httpd="`$xs -q SBINDIR`/`$xs -q TARGET`"
567   if test "x$httpd" != "x" && test -f $httpd ; then
568      v=`$httpd -v|$SED -n -e 's/.*Apache\/\.*//p'`
569      case $v in
570        1.3*)   [enable_apache_13]=yes
571                [with_apxs]=$xs
572                AC_MSG_RESULT(1.3)
573                ;;
574        2.0*)   [enable_apache_20]=yes
575                [with_apxs2]=$xs
576                AC_MSG_RESULT(2.0)
577                ;;
578        2.2*)   [enable_apache_22]=yes
579                [with_apxs22]=$xs
580                AC_MSG_RESULT(2.2)
581                ;;
582        *)      AC_MSG_ERROR(unusable apache versions: $v. Try setting --with-apxs)
583      esac
584   else 
585      AC_MSG_RESULT(cannot determine version.  Try setting --with-apxs)
586   fi
587 fi
588
589 # Apache 1.3 (mod_shib_13)
590 #   --enable-apache-13
591 #   --with-apxs      (DSO build, the normal way, uses apxs to derive build flags)
592
593 AC_ARG_ENABLE(apache-13,
594         AS_HELP_STRING([--enable-apache-13],[enable the Apache 1.3 module]),
595         [if test "x$enableval" = "x" ; then
596          WANT_APACHE_13=yes
597          else
598              WANT_APACHE_13="$enableval"
599          fi
600         ],[ WANT_APACHE_13=no ])
601 AC_MSG_CHECKING(whether to build Apache 1.3 module)
602 if test "$WANT_APACHE_13" != yes && test "$WANT_APACHE_13" != no ; then
603    WANT_APACHE_13=yes
604 fi
605 AC_MSG_RESULT($WANT_APACHE_13)
606
607 if test "$WANT_APACHE_13" = "yes" ; then
608     AC_ARG_WITH(apxs, 
609         AS_HELP_STRING([--with-apxs=FILE],[Specifies where to find the Apache 1.3 apxs script.]),
610         [
611         AC_MSG_CHECKING(for user-specified apxs name/location)
612         if test "$withval" != "no" ; then
613           if test "$withval" != "yes"; then
614             APXS=$withval
615             AC_MSG_RESULT("$withval")
616           fi
617         fi
618         ],
619         [
620         AC_PATH_PROG(APXS, apxs, no)
621         if test "$APXS" = "no" ; then
622           for i in /usr/sbin /usr/local/apache/bin ; do
623             if test "$APXS" = "no" && test -f "$i/apxs"; then
624               APXS="$i/apxs"
625             fi
626           done
627         fi
628         ])
629
630     AC_MSG_CHECKING([to see if apxs was located])
631     if test ! -f "$APXS" ; then
632         AC_MSG_RESULT(no)
633         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.])
634     fi
635     AC_MSG_RESULT($APXS)
636     AC_SUBST(APXS)
637
638     # extract settings we need from APXS -q
639     APXS_CC="`$APXS -q CC`"
640     APXS_CFLAGS="`$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
641     APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
642 fi
643
644 AC_SUBST(APXS_CFLAGS)
645 AC_SUBST(APXS_INCLUDE)
646
647
648 # Apache 2.0 (mod_shib_20)
649 #   --enable-apache-20
650 #   --with-apxs2      (DSO build, the normal way, uses apxs to derive build flags)
651 #       --with-apr        (DSO build, APR development package installed separately)
652 #   --with-apu        (DSO build, APR-UTIL development package installed separately)
653
654 AC_ARG_ENABLE(apache-20,
655         AS_HELP_STRING([--enable-apache-20],[enable the Apache 2.0 module]),
656         [if test "x$enableval" = "x" ; then
657          WANT_APACHE_20=yes
658          else
659              WANT_APACHE_20="$enableval"
660          fi
661         ],[ WANT_APACHE_20=no ])
662 AC_MSG_CHECKING(whether to build Apache 2.0 module)
663 if test "$WANT_APACHE_20" != yes && test "$WANT_APACHE_20" != no ; then
664     WANT_APACHE_20=yes
665 fi
666 AC_MSG_RESULT($WANT_APACHE_20)
667
668 if test "$WANT_APACHE_20" = "yes" ; then
669     AC_ARG_WITH(apxs2, 
670         AS_HELP_STRING([--with-apxs2=FILE],[Specifies where to find the Apache 2.0 apxs script.]),
671         [
672         AC_MSG_CHECKING(for user-specified Apache 2.0 apxs name/location)
673         if test "$withval" != "no" ; then
674           if test "$withval" != "yes"; then
675             APXS2=$withval
676             AC_MSG_RESULT("$withval")
677           fi
678         fi
679         ],
680         [
681         AC_PATH_PROG(APXS2, apxs2, no)
682         if test "$APXS2" = "no" ; then
683             AC_PATH_PROG(APXS2, apxs, no)
684         fi
685         if test "$APXS2" = "no" ; then
686           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
687             if test "$APXS2" = "no" && test -f "$i/apxs2" ; then
688               APXS2="$i/apxs2"
689             fi
690           done
691           if test "$APXS2" = "no" ; then
692             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
693               if test "$APXS2" = "no" && test -f "$i/apxs" ; then
694                 APXS2="$i/apxs"
695               fi
696             done
697           fi
698         fi
699         ])
700
701     AC_MSG_CHECKING([to see if Apache 2.0 apxs was located])
702     if test ! -f "$APXS2" ; then
703         AC_MSG_RESULT(no)
704         AC_MSG_ERROR([Unable to locate Apache 2.0 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs2 option.])
705     fi
706     AC_MSG_RESULT($APXS2)
707     AC_SUBST(APXS2)
708
709     # APR settings
710     AC_ARG_WITH(apr, 
711         AS_HELP_STRING([--with-apr=PATH],[where apr-config is installed]),
712         [
713         AC_MSG_CHECKING(for user-specified apr-config name/location)
714         if test "$withval" != "no" ; then
715             if test "$withval" != "yes"; then
716                 APR_CONFIG=$withval
717                 AC_MSG_RESULT("$withval")
718             fi
719         fi
720         ],
721         [
722         AC_PATH_PROG(APR_CONFIG, apr-config,,[`$APXS2 -q SBINDIR`]:[$PATH])
723         ])
724         if test -f "${APR_CONFIG}"; then
725         APR_CFLAGS="`${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags` `${APR_CONFIG} --includes`"
726     else
727         AC_MSG_ERROR([Unable to locate apr-config, may need --with-apr option.])
728     fi
729
730     # APU settings
731     AC_ARG_WITH(apu, 
732         AS_HELP_STRING([--with-apu=PATH],[where apu-config is installed]),
733         [
734         AC_MSG_CHECKING(for user-specified apu-config name/location)
735         if test "$withval" != "no" ; then
736             if test "$withval" != "yes"; then
737                 APR_CONFIG=$withval
738                 AC_MSG_RESULT("$withval")
739             fi
740         fi
741         ],
742         [
743         AC_PATH_PROG(APU_CONFIG, apu-config,,[`$APXS2 -q SBINDIR`]:[$PATH])
744         ])
745     if test -f "${APU_CONFIG}"; then
746         APU_CFLAGS="`${APU_CONFIG} --includes`"
747     else
748         AC_MSG_ERROR([Unable to locate apu-config, may need --with-apu option.])
749     fi
750
751     # extract settings we need from APXS2 -q
752     APXS2_CC="`$APXS2 -q CC`"
753     APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` $APR_CFLAGS $APU_CFLAGS"
754     APXS2_INCLUDE="`$APXS2 -q INCLUDEDIR`"
755 fi
756
757 AC_SUBST(APXS2_CFLAGS)
758 AC_SUBST(APXS2_INCLUDE)
759
760
761 # Apache 2.2 (mod_shib_22)
762 #   --enable-apache-22
763 #   --with-apxs22     (DSO build, the normal way, uses apxs to derive build flags)
764 #       --with-apr1       (DSO build, APR development package installed separately)
765 #   --with-apu1       (DSO build, APR-UTIL development package installed separately)
766
767 AC_ARG_ENABLE(apache-22,
768         AS_HELP_STRING([--enable-apache-22],[enable the Apache 2.2 module]),
769         [if test "x$enableval" = "x" ; then
770          WANT_APACHE_22=yes
771          else
772              WANT_APACHE_22="$enableval"
773          fi
774         ],[ WANT_APACHE_22=no ])
775 AC_MSG_CHECKING(whether to build Apache 2.2 module)
776 if test "$WANT_APACHE_22" != yes && test "$WANT_APACHE_22" != no ; then
777     WANT_APACHE_22=yes
778 fi
779 AC_MSG_RESULT($WANT_APACHE_22)
780
781 if test "$WANT_APACHE_22" = "yes" ; then
782     AC_ARG_WITH(apxs22, 
783         AS_HELP_STRING([--with-apxs22=FILE],[Specifies where to find the Apache 2.2 apxs script.]),
784         [
785         AC_MSG_CHECKING(for user-specified Apache 2.2 apxs name/location)
786         if test "$withval" != "no" ; then
787           if test "$withval" != "yes"; then
788             APXS22=$withval
789             AC_MSG_RESULT("$withval")
790           fi
791         fi
792         ],
793         [
794         AC_PATH_PROG(APXS22, apxs2, no)
795         if test "$APXS22" = "no" ; then
796             AC_PATH_PROG(APXS22, apxs, no)
797         fi
798         if test "$APXS22" = "no" ; then
799           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
800             if test "$APXS22" = "no" && test -f "$i/apxs2" ; then
801               APXS22="$i/apxs2"
802             fi
803           done
804           if test "$APXS22" = "no" ; then
805             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
806               if test "$APXS22" = "no" && test -f "$i/apxs" ; then
807                 APXS22="$i/apxs"
808               fi
809             done
810           fi
811         fi
812         ])
813
814     AC_MSG_CHECKING([to see if Apache 2.2 apxs was located])
815     if test ! -f "$APXS22" ; then
816         AC_MSG_RESULT(no)
817         AC_MSG_ERROR([Unable to locate Apache 2.2 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs22 option.])
818     fi
819     AC_MSG_RESULT($APXS22)
820     AC_SUBST(APXS22)
821
822     # APR1 settings
823     AC_ARG_WITH(apr1, 
824         AS_HELP_STRING([--with-apr1=PATH],[where apr-1-config is installed]),
825         [
826         AC_MSG_CHECKING(for user-specified apr-1-config name/location)
827         if test "$withval" != "no" ; then
828             if test "$withval" != "yes"; then
829                 APR1_CONFIG=$withval
830                 AC_MSG_RESULT("$withval")
831             fi
832         fi
833         ],
834         [
835         AC_PATH_PROG(APR1_CONFIG, apr-1-config,,[`$APXS22 -q SBINDIR`]:[$PATH])
836         ])
837         if test -f "${APR1_CONFIG}"; then
838         APR1_CFLAGS="`${APR1_CONFIG} --cflags` `${APR1_CONFIG} --cppflags` `${APR1_CONFIG} --includes`"
839     else
840         AC_MSG_ERROR([Unable to locate apr-1-config, may need --with-apr1 option.])
841     fi
842
843     # APU1 settings
844     AC_ARG_WITH(apu1, 
845         AS_HELP_STRING([--with-apu1=PATH],[where apu-1-config is installed]),
846         [
847         AC_MSG_CHECKING(for user-specified apu-1-config name/location)
848         if test "$withval" != "no" ; then
849             if test "$withval" != "yes"; then
850                 APU1_CONFIG=$withval
851                 AC_MSG_RESULT("$withval")
852             fi
853         fi
854         ],
855         [
856         AC_PATH_PROG(APU1_CONFIG, apu-1-config,,[`$APXS22 -q SBINDIR`]:[$PATH])
857         ])
858     if test -f "${APU1_CONFIG}"; then
859         APU1_CFLAGS="`${APU1_CONFIG} --includes`"
860     else
861         AC_MSG_ERROR([Unable to locate apu-1-config, may need --with-apu1 option.])
862     fi
863
864     # extract settings we need from APXS22 -q
865     APXS22_CC="`$APXS22 -q CC`"
866     APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` $APR1_CFLAGS $APU1_CFLAGS"
867     APXS22_INCLUDE="`$APXS22 -q INCLUDEDIR`"
868 fi
869
870 AC_SUBST(APXS22_CFLAGS)
871 AC_SUBST(APXS22_INCLUDE)
872
873 # Apache 2.4 (mod_shib_24)
874 #   --enable-apache-24
875 #   --with-apxs24     (DSO build, the normal way, uses apxs to derive build flags)
876 #       --with-apr1       (DSO build, APR development package installed separately)
877 #   --with-apu1       (DSO build, APR-UTIL development package installed separately)
878
879 AC_ARG_ENABLE(apache-24,
880         AS_HELP_STRING([--enable-apache-24],[enable the Apache 2.4 module]),
881         [if test "x$enableval" = "x" ; then
882          WANT_APACHE_24=yes
883          else
884              WANT_APACHE_24="$enableval"
885          fi
886         ],[ WANT_APACHE_24=no ])
887 AC_MSG_CHECKING(whether to build Apache 2.4 module)
888 if test "$WANT_APACHE_24" != yes && test "$WANT_APACHE_24" != no ; then
889     WANT_APACHE_24=yes
890 fi
891 AC_MSG_RESULT($WANT_APACHE_24)
892
893 if test "$WANT_APACHE_24" = "yes" ; then
894     AC_ARG_WITH(apxs24, 
895         AS_HELP_STRING([--with-apxs24=FILE],[Specifies where to find the Apache 2.4 apxs script.]),
896         [
897         AC_MSG_CHECKING(for user-specified Apache 2.4 apxs name/location)
898         if test "$withval" != "no" ; then
899           if test "$withval" != "yes"; then
900             APXS24=$withval
901             AC_MSG_RESULT("$withval")
902           fi
903         fi
904         ],
905         [
906         AC_PATH_PROG(APXS24, apxs2, no)
907         if test "$APXS24" = "no" ; then
908             AC_PATH_PROG(APXS24, apxs, no)
909         fi
910         if test "$APXS24" = "no" ; then
911           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
912             if test "$APXS24" = "no" && test -f "$i/apxs2" ; then
913               APXS24="$i/apxs2"
914             fi
915           done
916           if test "$APXS24" = "no" ; then
917             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
918               if test "$APXS24" = "no" && test -f "$i/apxs" ; then
919                 APXS24="$i/apxs"
920               fi
921             done
922           fi
923         fi
924         ])
925
926     AC_MSG_CHECKING([to see if Apache 2.4 apxs was located])
927     if test ! -f "$APXS24" ; then
928         AC_MSG_RESULT(no)
929         AC_MSG_ERROR([Unable to locate Apache 2.4 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs24 option.])
930     fi
931     AC_MSG_RESULT($APXS24)
932     AC_SUBST(APXS24)
933
934     # extract settings we need from APXS24 -q
935     APXS24_CC="`$APXS24 -q CC`"
936     APXS24_CFLAGS="`$APXS24 -q CPPFLAGS` `$APXS24 -q CFLAGS` $APR1_CFLAGS $APU1_CFLAGS"
937     APXS24_INCLUDE="`$APXS24 -q INCLUDEDIR`"
938 fi
939
940 AC_SUBST(APXS24_CFLAGS)
941 AC_SUBST(APXS24_INCLUDE)
942
943 # always output the Makefile, even if you don't use it
944 AC_CONFIG_FILES([apache/Makefile])
945 AM_CONDITIONAL(BUILD_AP13,test "$WANT_APACHE_13" = "yes")
946 AM_CONDITIONAL(BUILD_AP20,test "$WANT_APACHE_20" = "yes")
947 AM_CONDITIONAL(BUILD_AP22,test "$WANT_APACHE_22" = "yes")
948 AM_CONDITIONAL(BUILD_AP24,test "$WANT_APACHE_24" = "yes")
949
950 # add the apache module to the list of wanted subdirs..
951 if test "$WANT_APACHE_13" = "yes" || test "$WANT_APACHE_20" = "yes" || test "$WANT_APACHE_22" = "yes" || test "$WANT_APACHE_24" = "yes" ; then
952     WANT_SUBDIRS="$WANT_SUBDIRS apache"
953 fi
954
955
956 #
957 # Implement the checks of the ODBC Storage Service
958 #
959 # 1) Assume the user wants ODBC; if it's not found then just continue without
960 # 2) If the user specifically requested odbc, look for it and ERROR if not found
961 # 3) If the user specifically requested no odbc, don't build it.
962 #
963
964 AC_CONFIG_FILES([odbc-store/Makefile])
965
966 # determine whether we should enable the odbc ccache
967 AC_ARG_ENABLE([odbc],
968         AS_HELP_STRING([--disable-odbc],[disable the ODBC Storage Service]),
969         [odbc_enabled=$enableval], [odbc_enabled=default])
970 if test "x$odbc_enabled" = "x" ; then
971     odbc_enabled=yes
972 fi
973
974 # Are we trying to build ODBC?
975 AC_MSG_CHECKING(whether to build the ODBC storage service)
976 if test "$odbc_enabled" = "yes" ; then
977     build_odbc=yes
978     AC_MSG_RESULT(yes)
979 elif test "$odbc_enabled" = "default" ; then
980     build_odbc=yes
981     AC_MSG_RESULT([yes, if it can be found])
982 else
983     build_odbc=no
984     AC_MSG_RESULT(no)
985 fi
986
987 # If we're trying to build ODBC, try to find the odbc_config program.
988 if test "$build_odbc" = "yes" ; then
989     odbc_dir=""
990     AC_ARG_WITH(odbc,
991            AS_HELP_STRING([--with-odbc=PATH],[directory where odbc is installed]),
992             [if test "$with_odbc" = no ; then
993             AC_MSG_ERROR([Try running --disable-odbc instead.])
994          elif test "$with_odbc" != yes ; then
995             odbc_dir="$with_odbc/bin"
996             if test "$with_odbc" != /usr ; then
997                 ODBC_CFLAGS="-I$with_odbc/include"
998                 ODBC_LIBS="-L$with_odbc/lib"
999             fi
1000          fi])
1001
1002    AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
1003    if test "$ODBC_CONFIG" = no ; then
1004       AC_MSG_WARN([Cannot find odbc_config, will try to guess settings.])
1005       ODBC_LIBS="$ODBC_LIBS -lodbc"
1006    else
1007       ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
1008       ODBC_LIBS=`$ODBC_CONFIG --libs`
1009    fi
1010
1011    save_CPPFLAGS="$CPPFLAGS"
1012    CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
1013
1014    AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
1015    if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
1016      AC_MSG_ERROR(unable to find ODBC header files)
1017    fi
1018
1019    if test "$have_sql_h" = yes ; then
1020       save_LIBS="$LIBS"
1021       LIBS="$LIBS $ODBC_LIBS"
1022       AC_MSG_CHECKING(if we can link againt ODBC)
1023       AC_LINK_IFELSE(
1024         [AC_LANG_PROGRAM([[#include <sql.h>
1025  #include <sqlext.h>
1026  #include <stdio.h>]],
1027             [[SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)]])],
1028         [have_odbc_libs=yes],[have_odbc_libs=no])
1029       LIBS="$save_LIBS"
1030       if test "$have_odbc_libs" = no ; then
1031          if test "$odbc_enabled" = "yes" ; then
1032             AC_MSG_ERROR([unable to link with ODBC Library])
1033          else
1034             AC_MSG_RESULT([no, skipping ODBC])
1035          fi
1036       fi
1037    fi
1038
1039    CPPFLAGS="$save_CPPFLAGS"
1040 fi
1041
1042 # if have_odbc_libs=yes then go ahead with building ODBC
1043 if test "$have_odbc_libs" = yes ; then
1044    # this AC_MSG_RESULT is from above!
1045    AC_MSG_RESULT(yes)
1046    WANT_SUBDIRS="$WANT_SUBDIRS odbc-store"
1047    AC_SUBST(ODBC_CFLAGS)
1048    AC_SUBST(ODBC_LIBS)
1049 fi
1050
1051 # GSS-API checking
1052
1053 GSSAPI_ROOT="/usr"
1054 AC_ARG_WITH(gssapi-includes,
1055   AS_HELP_STRING([--with-gssapi-includes=DIR],[Specify location of GSSAPI header]),
1056   [ GSSAPI_INCS="-I$withval"
1057     want_gss="yes" ]
1058 )
1059
1060 AC_ARG_WITH(gssapi-libs,
1061   AS_HELP_STRING([--with-gssapi-libs=DIR],[Specify location of GSSAPI libs]),
1062   [ GSSAPI_LIB_DIR="-L$withval"
1063     want_gss="yes" ]
1064 )
1065
1066 AC_ARG_WITH(gssapi,
1067   AS_HELP_STRING([--with-gssapi=DIR],[Where to look for GSSAPI]),
1068   [ GSSAPI_ROOT="$withval"
1069   if test x"$GSSAPI_ROOT" != xno; then
1070     want_gss="yes"
1071     if test x"$GSSAPI_ROOT" = xyes; then
1072       dnl if yes, then use default root
1073       GSSAPI_ROOT="/usr"
1074     fi
1075   fi
1076 ])
1077
1078 save_CPPFLAGS="$CPPFLAGS"
1079 AC_MSG_CHECKING([if GSSAPI support is requested])
1080 if test x"$want_gss" = xyes; then
1081   AC_MSG_RESULT(yes)
1082
1083   if test -z "$GSSAPI_INCS"; then
1084      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1085         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
1086      elif test "$GSSAPI_ROOT" != "yes"; then
1087         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1088      fi
1089   fi
1090
1091   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1092
1093   AC_CHECK_HEADER(gss.h,
1094     [
1095       dnl found in the given dirs
1096       AC_DEFINE([SHIBSP_HAVE_GSSGNU],[1],[if you have the GNU gssapi libraries])
1097       gnu_gss=yes
1098     ],
1099     [
1100       dnl not found, check Heimdal or MIT
1101       AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1102       AC_CHECK_HEADERS(
1103         [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1104         [],
1105         [not_mit=1],
1106         [
1107 AC_INCLUDES_DEFAULT
1108 #ifdef HAVE_GSSAPI_GSSAPI_H
1109 #include <gssapi/gssapi.h>
1110 #endif
1111         ])
1112       if test "x$not_mit" = "x1"; then
1113         dnl MIT not found, check for Heimdal
1114         AC_CHECK_HEADER([gssapi.h],
1115             [
1116               dnl found
1117               AC_DEFINE([SHIBSP_HAVE_GSSHEIMDAL],[1],[if you have the Heimdal gssapi libraries])
1118             ],
1119             [
1120               dnl no header found, disabling GSS
1121               want_gss=no
1122               AC_MSG_WARN([disabling GSSAPI since no header files was found])
1123             ]
1124           )
1125       else
1126         dnl MIT found
1127         AC_DEFINE([SHIBSP_HAVE_GSSMIT],[1],[if you have the MIT gssapi libraries])
1128         dnl check if we have a really old MIT kerberos (<= 1.2)
1129         AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
1130         AC_COMPILE_IFELSE([
1131           AC_LANG_PROGRAM([[
1132 #include <gssapi/gssapi.h>
1133 #include <gssapi/gssapi_generic.h>
1134 #include <gssapi/gssapi_krb5.h>
1135           ]],[[
1136             gss_import_name(
1137                             (OM_uint32 *)0,
1138                             (gss_buffer_t)0,
1139                             GSS_C_NT_HOSTBASED_SERVICE,
1140                             (gss_name_t *)0);
1141           ]])
1142         ],[
1143           AC_MSG_RESULT([yes])
1144         ],[
1145           AC_MSG_RESULT([no])
1146           AC_DEFINE([HAVE_OLD_GSSMIT],[1],[if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
1147         ])
1148       fi
1149     ]
1150   )
1151 else
1152   AC_MSG_RESULT(no)
1153 fi
1154 if test x"$want_gss" = xyes; then
1155   AC_DEFINE([SHIBSP_HAVE_GSSAPI],[1],[if you have the gssapi libraries])
1156
1157   if test -n "$gnu_gss"; then
1158     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1159     LIBS="$LIBS -lgss"
1160   else
1161     if test -z "$GSSAPI_LIB_DIR"; then
1162       GSSAPI_LIB_DIR="$GSSAPI_ROOT/lib$libsuff"
1163     fi
1164     if test "$GSSAPI_ROOT" != "yes"; then
1165        LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1166     fi
1167     if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1168       dnl krb5-config doesn't have --libs-only-L or similar, put everything
1169       dnl into LIBS
1170       gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1171     else
1172       if test "x$not_mit" = "x1"; then
1173         gss_libs="-lgssapi"
1174       else
1175         gss_libs="-lgssapi_krb5"
1176       fi
1177     fi
1178     LIBS="$LIBS $gss_libs"
1179   fi
1180
1181   AC_MSG_CHECKING([whether GSS-API naming extensions are available])
1182   AC_COMPILE_IFELSE(
1183     [AC_LANG_PROGRAM([[
1184 #ifdef SHIBSP_HAVE_GSSGNU
1185 # include <gss.h>
1186 #elif defined SHIBSP_HAVE_GSSMIT
1187 # include <gssapi/gssapi.h>
1188 # include <gssapi/gssapi_ext.h>
1189 #else
1190 # include <gssapi.h>
1191 #endif]],
1192     [[gss_get_name_attribute(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);]])],
1193     [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_NAMINGEXTS],[1],[Define to 1 if GSS-API naming extensions are available.])],
1194     [AC_MSG_RESULT([no])])
1195
1196   AC_MSG_CHECKING([whether GSS-API composite name import is available])
1197   AC_COMPILE_IFELSE(
1198     [AC_LANG_PROGRAM([[
1199 #ifdef SHIBSP_HAVE_GSSGNU
1200 # include <gss.h>
1201 #elif defined SHIBSP_HAVE_GSSMIT
1202 # include <gssapi/gssapi.h>
1203 # include <gssapi/gssapi_ext.h>
1204 #else
1205 # include <gssapi.h>
1206 #endif]],
1207     [[
1208     OM_uint32 minor;
1209     gss_name_t srcname;
1210     gss_buffer_desc importbuf;
1211     gss_import_name(&minor, &importbuf, GSS_C_NT_EXPORT_NAME_COMPOSITE, &srcname);
1212     ]])],
1213     [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_COMPOSITE_NAME],[1],[Define to 1 if GSS-API composite name import is available.])],
1214     [AC_MSG_RESULT([no])])
1215     
1216 else
1217   CPPFLAGS="$save_CPPFLAGS"
1218 fi
1219
1220
1221 AC_SUBST(WANT_SUBDIRS)
1222
1223 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
1224   echo "=================================================================="
1225   echo "WARNING: You have chosen to compile Apache-1.3 modules with a different"
1226   echo "         compiler than the one used to compile Apache."
1227   echo ""
1228   echo "    Current compiler:      $CC"
1229   echo "   Apache's compiler:      $APXS_CC"
1230   echo ""
1231   echo "This could cause problems."
1232   echo "=================================================================="
1233 fi
1234
1235 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
1236   echo "=================================================================="
1237   echo "WARNING: You have chosen to compile Apache-2.0 modules with a different"
1238   echo "         compiler than the one used to compile Apache."
1239   echo ""
1240   echo "    Current compiler:      $CC"
1241   echo "   Apache's compiler:      $APXS2_CC"
1242   echo ""
1243   echo "This could cause problems."
1244   echo "=================================================================="
1245 fi
1246
1247 if test -n "$APXS22_CC" && test "$APXS22_CC" != "$CC" ; then
1248   echo "=================================================================="
1249   echo "WARNING: You have chosen to compile Apache-2.2 modules with a different"
1250   echo "         compiler than the one used to compile Apache."
1251   echo ""
1252   echo "    Current compiler:      $CC"
1253   echo "   Apache's compiler:      $APXS22_CC"
1254   echo ""
1255   echo "This could cause problems."
1256   echo "=================================================================="
1257 fi
1258
1259 if test -n "$APXS24_CC" && test "$APXS24_CC" != "$CC" ; then
1260   echo "=================================================================="
1261   echo "WARNING: You have chosen to compile Apache-2.4 modules with a different"
1262   echo "         compiler than the one used to compile Apache."
1263   echo ""
1264   echo "    Current compiler:      $CC"
1265   echo "   Apache's compiler:      $APXS24_CC"
1266   echo ""
1267   echo "This could cause problems."
1268   echo "=================================================================="
1269 fi
1270
1271 LIBTOOL="$LIBTOOL --silent"
1272
1273 AC_OUTPUT