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