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