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