https://issues.shibboleth.net/jira/browse/SSPCPP-460
[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 localtime_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                 APU_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     # If we haven't done this work already for Apache 2.2
937     if test "$WANT_APACHE_22" != "yes" ; then
938         # APR1 settings
939         AC_ARG_WITH(apr1,
940             AS_HELP_STRING([--with-apr1=PATH],[where apr-1-config is installed]),
941             [
942             AC_MSG_CHECKING(for user-specified apr-1-config name/location)
943             if test "$withval" != "no" ; then
944                 if test "$withval" != "yes"; then
945                     APR1_CONFIG=$withval
946                     AC_MSG_RESULT("$withval")
947                 fi
948             fi
949             ],
950             [
951             AC_PATH_PROG(APR1_CONFIG, apr-1-config,,[`$APXS22 -q SBINDIR`]:[$PATH])
952             ])
953         if test -f "${APR1_CONFIG}"; then
954             APR1_CFLAGS="`${APR1_CONFIG} --cflags` `${APR1_CONFIG} --cppflags` `${APR1_CONFIG} --includes`"
955         else
956             AC_MSG_ERROR([Unable to locate apr-1-config, may need --with-apr1 option.])
957         fi
958
959         # APU1 settings
960         AC_ARG_WITH(apu1,
961             AS_HELP_STRING([--with-apu1=PATH],[where apu-1-config is installed]),
962             [
963             AC_MSG_CHECKING(for user-specified apu-1-config name/location)
964             if test "$withval" != "no" ; then
965                 if test "$withval" != "yes"; then
966                     APU1_CONFIG=$withval
967                     AC_MSG_RESULT("$withval")
968                 fi
969             fi
970             ],
971             [
972             AC_PATH_PROG(APU1_CONFIG, apu-1-config,,[`$APXS22 -q SBINDIR`]:[$PATH])
973             ])
974         if test -f "${APU1_CONFIG}"; then
975             APU1_CFLAGS="`${APU1_CONFIG} --includes`"
976         else
977             AC_MSG_ERROR([Unable to locate apu-1-config, may need --with-apu1 option.])
978         fi
979     fi
980     
981     # extract settings we need from APXS24 -q
982     APXS24_CC="`$APXS24 -q CC`"
983     APXS24_CFLAGS="`$APXS24 -q CPPFLAGS` `$APXS24 -q CFLAGS` $APR1_CFLAGS $APU1_CFLAGS"
984     APXS24_INCLUDE="`$APXS24 -q INCLUDEDIR`"
985 fi
986
987 AC_SUBST(APXS24_CFLAGS)
988 AC_SUBST(APXS24_INCLUDE)
989
990 # always output the Makefile, even if you don't use it
991 AC_CONFIG_FILES([apache/Makefile])
992 AM_CONDITIONAL(BUILD_AP13,test "$WANT_APACHE_13" = "yes")
993 AM_CONDITIONAL(BUILD_AP20,test "$WANT_APACHE_20" = "yes")
994 AM_CONDITIONAL(BUILD_AP22,test "$WANT_APACHE_22" = "yes")
995 AM_CONDITIONAL(BUILD_AP24,test "$WANT_APACHE_24" = "yes")
996
997 # add the apache module to the list of wanted subdirs..
998 if test "$WANT_APACHE_13" = "yes" || test "$WANT_APACHE_20" = "yes" || test "$WANT_APACHE_22" = "yes" || test "$WANT_APACHE_24" = "yes" ; then
999     WANT_SUBDIRS="$WANT_SUBDIRS apache"
1000 fi
1001
1002
1003 #
1004 # Implement the checks of the ODBC Storage Service
1005 #
1006 # 1) Assume the user wants ODBC; if it's not found then just continue without
1007 # 2) If the user specifically requested odbc, look for it and ERROR if not found
1008 # 3) If the user specifically requested no odbc, don't build it.
1009 #
1010
1011 AC_CONFIG_FILES([odbc-store/Makefile])
1012
1013 # determine whether we should enable the odbc ccache
1014 AC_ARG_ENABLE([odbc],
1015         AS_HELP_STRING([--disable-odbc],[disable the ODBC Storage Service]),
1016         [odbc_enabled=$enableval], [odbc_enabled=default])
1017 if test "x$odbc_enabled" = "x" ; then
1018     odbc_enabled=yes
1019 fi
1020
1021 # Are we trying to build ODBC?
1022 AC_MSG_CHECKING(whether to build the ODBC storage service)
1023 if test "$odbc_enabled" = "yes" ; then
1024     build_odbc=yes
1025     AC_MSG_RESULT(yes)
1026 elif test "$odbc_enabled" = "default" ; then
1027     build_odbc=yes
1028     AC_MSG_RESULT([yes, if it can be found])
1029 else
1030     build_odbc=no
1031     AC_MSG_RESULT(no)
1032 fi
1033
1034 # If we're trying to build ODBC, try to find the odbc_config program.
1035 if test "$build_odbc" = "yes" ; then
1036     odbc_dir=""
1037     AC_ARG_WITH(odbc,
1038            AS_HELP_STRING([--with-odbc=PATH],[directory where odbc is installed]),
1039             [if test "$with_odbc" = no ; then
1040             AC_MSG_ERROR([Try running --disable-odbc instead.])
1041          elif test "$with_odbc" != yes ; then
1042             odbc_dir="$with_odbc/bin"
1043             if test "$with_odbc" != /usr ; then
1044                 ODBC_CFLAGS="-I$with_odbc/include"
1045                 ODBC_LIBS="-L$with_odbc/lib"
1046             fi
1047          fi])
1048
1049    AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
1050    if test "$ODBC_CONFIG" = no ; then
1051       AC_MSG_WARN([Cannot find odbc_config, will try to guess settings.])
1052       ODBC_LIBS="$ODBC_LIBS -lodbc"
1053    else
1054       ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
1055       ODBC_LIBS=`$ODBC_CONFIG --libs`
1056    fi
1057
1058    save_CPPFLAGS="$CPPFLAGS"
1059    CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
1060
1061    AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
1062    if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
1063      AC_MSG_ERROR(unable to find ODBC header files)
1064    fi
1065
1066    if test "$have_sql_h" = yes ; then
1067       save_LIBS="$LIBS"
1068       LIBS="$LIBS $ODBC_LIBS"
1069       AC_MSG_CHECKING(if we can link againt ODBC)
1070       AC_LINK_IFELSE(
1071         [AC_LANG_PROGRAM([[#include <sql.h>
1072  #include <sqlext.h>
1073  #include <stdio.h>]],
1074             [[SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)]])],
1075         [have_odbc_libs=yes],[have_odbc_libs=no])
1076       LIBS="$save_LIBS"
1077       if test "$have_odbc_libs" = no ; then
1078          if test "$odbc_enabled" = "yes" ; then
1079             AC_MSG_ERROR([unable to link with ODBC Library])
1080          else
1081             AC_MSG_RESULT([no, skipping ODBC])
1082          fi
1083       fi
1084    fi
1085
1086    CPPFLAGS="$save_CPPFLAGS"
1087 fi
1088
1089 # if have_odbc_libs=yes then go ahead with building ODBC
1090 if test "$have_odbc_libs" = yes ; then
1091    # this AC_MSG_RESULT is from above!
1092    AC_MSG_RESULT(yes)
1093    WANT_SUBDIRS="$WANT_SUBDIRS odbc-store"
1094    AC_SUBST(ODBC_CFLAGS)
1095    AC_SUBST(ODBC_LIBS)
1096 fi
1097
1098 # GSS-API checking
1099
1100 GSSAPI_ROOT="/usr"
1101 AC_ARG_WITH(gssapi-includes,
1102   AS_HELP_STRING([--with-gssapi-includes=DIR],[Specify location of GSSAPI header]),
1103   [ GSSAPI_INCS="-I$withval"
1104     want_gss="yes" ]
1105 )
1106
1107 AC_ARG_WITH(gssapi-libs,
1108   AS_HELP_STRING([--with-gssapi-libs=DIR],[Specify location of GSSAPI libs]),
1109   [ GSSAPI_LIB_DIR="-L$withval"
1110     want_gss="yes" ]
1111 )
1112
1113 AC_ARG_WITH(gssapi,
1114   AS_HELP_STRING([--with-gssapi=DIR],[Where to look for GSSAPI]),
1115   [ GSSAPI_ROOT="$withval"
1116   if test x"$GSSAPI_ROOT" != xno; then
1117     want_gss="yes"
1118     if test x"$GSSAPI_ROOT" = xyes; then
1119       dnl if yes, then use default root
1120       GSSAPI_ROOT="/usr"
1121     fi
1122   fi
1123 ])
1124
1125 save_CPPFLAGS="$CPPFLAGS"
1126 AC_MSG_CHECKING([if GSSAPI support is requested])
1127 if test x"$want_gss" = xyes; then
1128   AC_MSG_RESULT(yes)
1129
1130   if test -z "$GSSAPI_INCS"; then
1131      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1132         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
1133      elif test "$GSSAPI_ROOT" != "yes"; then
1134         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1135      fi
1136   fi
1137
1138   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1139
1140   AC_CHECK_HEADER(gss.h,
1141     [
1142       dnl found in the given dirs
1143       AC_DEFINE([SHIBSP_HAVE_GSSGNU],[1],[if you have the GNU gssapi libraries])
1144       gnu_gss=yes
1145     ],
1146     [
1147       dnl not found, check Heimdal or MIT
1148       AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1149       AC_CHECK_HEADERS(
1150         [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1151         [],
1152         [not_mit=1],
1153         [
1154 AC_INCLUDES_DEFAULT
1155 #ifdef HAVE_GSSAPI_GSSAPI_H
1156 #include <gssapi/gssapi.h>
1157 #endif
1158         ])
1159       if test "x$not_mit" = "x1"; then
1160         dnl MIT not found, check for Heimdal
1161         AC_CHECK_HEADER([gssapi.h],
1162             [
1163               dnl found
1164               AC_DEFINE([SHIBSP_HAVE_GSSHEIMDAL],[1],[if you have the Heimdal gssapi libraries])
1165             ],
1166             [
1167               dnl no header found, disabling GSS
1168               want_gss=no
1169               AC_MSG_WARN([disabling GSSAPI since no header files was found])
1170             ]
1171           )
1172       else
1173         dnl MIT found
1174         AC_DEFINE([SHIBSP_HAVE_GSSMIT],[1],[if you have the MIT gssapi libraries])
1175         dnl check if we have a really old MIT kerberos (<= 1.2)
1176         AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
1177         AC_COMPILE_IFELSE([
1178           AC_LANG_PROGRAM([[
1179 #include <gssapi/gssapi.h>
1180 #include <gssapi/gssapi_generic.h>
1181 #include <gssapi/gssapi_krb5.h>
1182           ]],[[
1183             gss_import_name(
1184                             (OM_uint32 *)0,
1185                             (gss_buffer_t)0,
1186                             GSS_C_NT_HOSTBASED_SERVICE,
1187                             (gss_name_t *)0);
1188           ]])
1189         ],[
1190           AC_MSG_RESULT([yes])
1191         ],[
1192           AC_MSG_RESULT([no])
1193           AC_DEFINE([HAVE_OLD_GSSMIT],[1],[if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
1194         ])
1195       fi
1196     ]
1197   )
1198 else
1199   AC_MSG_RESULT(no)
1200 fi
1201 if test x"$want_gss" = xyes; then
1202   AC_DEFINE([SHIBSP_HAVE_GSSAPI],[1],[if you have the gssapi libraries])
1203
1204   if test -n "$gnu_gss"; then
1205     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1206     LIBS="$LIBS -lgss"
1207   else
1208     if test -z "$GSSAPI_LIB_DIR"; then
1209       GSSAPI_LIB_DIR="$GSSAPI_ROOT/lib$libsuff"
1210     fi
1211     if test "$GSSAPI_ROOT" != "yes"; then
1212        LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1213     fi
1214     if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1215       dnl krb5-config doesn't have --libs-only-L or similar, put everything
1216       dnl into LIBS
1217       gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1218     else
1219       if test "x$not_mit" = "x1"; then
1220         gss_libs="-lgssapi"
1221       else
1222         gss_libs="-lgssapi_krb5"
1223       fi
1224     fi
1225     LIBS="$LIBS $gss_libs"
1226   fi
1227
1228   AC_MSG_CHECKING([whether GSS-API naming extensions are available])
1229   AC_COMPILE_IFELSE(
1230     [AC_LANG_PROGRAM([[
1231 #ifdef SHIBSP_HAVE_GSSGNU
1232 # include <gss.h>
1233 #elif defined SHIBSP_HAVE_GSSMIT
1234 # include <gssapi/gssapi.h>
1235 # include <gssapi/gssapi_ext.h>
1236 #else
1237 # include <gssapi.h>
1238 #endif]],
1239     [[gss_get_name_attribute(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);]])],
1240     [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_NAMINGEXTS],[1],[Define to 1 if GSS-API naming extensions are available.])],
1241     [AC_MSG_RESULT([no])])
1242
1243   AC_MSG_CHECKING([whether GSS-API composite name import is available])
1244   AC_COMPILE_IFELSE(
1245     [AC_LANG_PROGRAM([[
1246 #ifdef SHIBSP_HAVE_GSSGNU
1247 # include <gss.h>
1248 #elif defined SHIBSP_HAVE_GSSMIT
1249 # include <gssapi/gssapi.h>
1250 # include <gssapi/gssapi_ext.h>
1251 #else
1252 # include <gssapi.h>
1253 #endif]],
1254     [[
1255     OM_uint32 minor;
1256     gss_name_t srcname;
1257     gss_buffer_desc importbuf;
1258     gss_import_name(&minor, &importbuf, GSS_C_NT_EXPORT_NAME_COMPOSITE, &srcname);
1259     ]])],
1260     [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_COMPOSITE_NAME],[1],[Define to 1 if GSS-API composite name import is available.])],
1261     [AC_MSG_RESULT([no])])
1262     
1263 else
1264   CPPFLAGS="$save_CPPFLAGS"
1265 fi
1266
1267
1268 AC_SUBST(WANT_SUBDIRS)
1269
1270 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
1271   echo "=================================================================="
1272   echo "WARNING: You have chosen to compile Apache-1.3 modules with a different"
1273   echo "         compiler than the one used to compile Apache."
1274   echo ""
1275   echo "    Current compiler:      $CC"
1276   echo "   Apache's compiler:      $APXS_CC"
1277   echo ""
1278   echo "This could cause problems."
1279   echo "=================================================================="
1280 fi
1281
1282 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
1283   echo "=================================================================="
1284   echo "WARNING: You have chosen to compile Apache-2.0 modules with a different"
1285   echo "         compiler than the one used to compile Apache."
1286   echo ""
1287   echo "    Current compiler:      $CC"
1288   echo "   Apache's compiler:      $APXS2_CC"
1289   echo ""
1290   echo "This could cause problems."
1291   echo "=================================================================="
1292 fi
1293
1294 if test -n "$APXS22_CC" && test "$APXS22_CC" != "$CC" ; then
1295   echo "=================================================================="
1296   echo "WARNING: You have chosen to compile Apache-2.2 modules with a different"
1297   echo "         compiler than the one used to compile Apache."
1298   echo ""
1299   echo "    Current compiler:      $CC"
1300   echo "   Apache's compiler:      $APXS22_CC"
1301   echo ""
1302   echo "This could cause problems."
1303   echo "=================================================================="
1304 fi
1305
1306 if test -n "$APXS24_CC" && test "$APXS24_CC" != "$CC" ; then
1307   echo "=================================================================="
1308   echo "WARNING: You have chosen to compile Apache-2.4 modules with a different"
1309   echo "         compiler than the one used to compile Apache."
1310   echo ""
1311   echo "    Current compiler:      $CC"
1312   echo "   Apache's compiler:      $APXS24_CC"
1313   echo ""
1314   echo "This could cause problems."
1315   echo "=================================================================="
1316 fi
1317
1318 LIBTOOL="$LIBTOOL --silent"
1319
1320 AC_OUTPUT