2 AC_INIT([shibboleth], [1.0.1], [mace-shib-users@internet2.edu], [shibboleth])
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(shibboleth, 1.0.1)
6 sinclude(acx_pthread.m4)
7 sinclude(acx_rpctest.m4)
9 AC_PROG_CC([gcc3 gcc cc])
10 AC_PROG_CXX([g++3 g++ c++ CC])
16 # Checks for typedefs, structures, and compiler characteristics.
21 # Checks for library functions.
23 AC_CHECK_FUNCS([strchr strdup strstr gmtime_r strtok_r strcasecmp])
24 AC_CHECK_HEADERS([dlfcn.h])
32 # AC_SEARCH_LIBS(xdr_uint64_t,nsl,,
33 # [CFLAGS="$CFLAGS -DNEED_XDR_LONGLONG"
34 # CXXFLAGS="$CXXFLAGS -DNEED_XDR_LONGLONG"])
38 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
39 if test $enable_threads != "pthread"; then
40 AC_MSG_ERROR([unable to find pthreads, currently this is required])
42 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
43 LIBS="$PTHREAD_LIBS $LIBS"
44 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
45 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
48 # Test RPC now -- deal with it later
49 ACX_RPCTEST([rpctest="yes"],[rpctest="no"])
51 # Determine whether to use TCP for the shar socket
53 AC_HELP_STRING([--enable-tcp], [enable the SHAR to use a TCP socket on Unix]),
54 [tcp_enabled=$enableval], [tcp_enabled=default])
56 if test "x$tcp_enabled" = "x" ; then
60 if test "$tcp_enabled" = "yes" ; then
61 CFLAGS="$CFLAGS -DWANT_TCP_SHAR"
62 CXXFLAGS="$CXXFLAGS -DWANT_TCP_SHAR"
66 AC_HELP_STRING([--with-dmalloc=PATH], [where dmalloc is installed]),
67 [if test x_$with_dmalloc != x_/usr; then
68 LDFLAGS="-L${with_dmalloc}/lib $LDFLAGS"
69 CPPFLAGS="-I${with_dmalloc}/include $CPPFLAGS"
71 AC_CHECK_LIB(dmallocxx, dmalloc_shutdown,,
72 AC_MSG_ERROR([unable to find dmallocxx library]))
76 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
77 [if test x_$with_xerces != x_/usr; then
78 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
79 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
84 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
85 [if test x_$with_openssl != x_/usr; then
86 LDFLAGS="-L${with_openssl}/lib $LDFLAGS"
87 CPPFLAGS="-I${with_openssl}/include $CPPFLAGS"
91 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp is installed]),
92 [if test x_$with_log4cpp != x_/usr; then
93 LDFLAGS="-L${with_log4cpp}/lib $LDFLAGS"
94 CPPFLAGS="-I${with_log4cpp}/include $CPPFLAGS"
98 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
99 [if test x_$with_xmlsec != x_/usr; then
100 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
101 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
105 AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
106 [if test x_$with_saml != x_/usr; then
107 LDFLAGS="-L${with_saml}/lib $LDFLAGS"
108 CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
111 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,
112 AC_MSG_ERROR([unable to find xerces header files]))
114 LIBS="-lxerces-c $LIBS"
116 [#include <xercesc/util/PlatformUtils.hpp>],
117 [xercesc::XMLPlatformUtils::Initialize()],
118 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
119 [AC_MSG_ERROR([unable to link with Xerces])
123 AC_CHECK_HEADER([openssl/ssl.h],,
124 AC_MSG_ERROR([unable to find openssl header files]))
125 AC_CHECK_LIB([crypto], [ERR_load_CRYPTO_strings],,
126 AC_MSG_ERROR([unable to link with openssl libraries]))
127 AC_CHECK_LIB([ssl], [SSL_library_init],,
128 AC_MSG_ERROR([unable to link with openssl libraries]))
130 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,
131 AC_MSG_ERROR([unable to find xsec header files]))
133 LIBS="-lxml-security-c $LIBS"
135 [#include <xsec/utils/XSECPlatformUtils.hpp>],
136 [XSECPlatformUtils::Initialise()],
137 [AC_DEFINE(HAVE_LIBXSEC,1,[Define if XML-Sec library was found])],
138 [AC_MSG_ERROR([unable to link with XML-Sec])
142 AC_CHECK_HEADER([log4cpp/Category.hh],,
143 AC_MSG_ERROR([unable to find log4cpp header files]))
145 AC_CHECK_HEADER([saml/saml.h],,
146 AC_MSG_ERROR([unable to find saml header files]))
149 LIBS="-llog4cpp $LIBS"
151 [#include <log4cpp/Category.hh>],
152 [log4cpp::Category::getInstance("foo")],
153 [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])],
154 [AC_MSG_ERROR([unable to link with log4cpp])
161 [#include <saml/saml.h>],
162 [saml::SAMLConfig::getConfig()],
163 [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])],
164 [AC_MSG_ERROR([unable to link with saml])
168 # output the underlying makefiles
169 WANT_SUBDIRS="doc shib schemas configs shib-target shar siterefresh test"
170 AC_CONFIG_FILES([Makefile doc/Makefile shib/Makefile schemas/Makefile \
171 configs/Makefile oncrpc/Makefile oncrpc/rpc/Makefile \
172 shib-target/Makefile shar/Makefile siterefresh/Makefile \
175 # now deal with the rpc library, to see if we need to build our own
176 if test $rpctest = "no"; then
177 WANT_SUBDIRS="oncrpc $WANT_SUBDIRS"
179 AM_CONDITIONAL(USE_OUR_ONCRPC,test "$rpctest" = "no")
181 # Much of this is taken from mod_dav.
182 # The basic idea is to use configure options to control whether/which types
183 # of web server modules get built. We assume there may eventually be multiple
184 # types (Apache 1/2, iPlanet, others).
186 # Apache 1.3 (mod_shire/mod_shibrm)
187 # --with-apache (static build, no idea how to do this yet, so not supported)
188 # --with-apxs (DSO build, the normal way, uses apxs to derive build flags)
189 # --without-apxs (DSO build, you tell us how to build using the environment)
191 AC_ARG_ENABLE(apache-13,
192 AC_HELP_STRING([--disable-apache-13], [disable the Apache 1.3 modules]))
193 if test "x$enable_apache_13" = "x" ; then
197 if test "$enable_apache_13" != yes ; then
198 AC_MSG_WARN(Building without Apache...)
202 AC_MSG_CHECKING([for dynamic Apache module support (w/ or w/o APXS)])
204 [ --with-apxs[=FILE] Build shared Apache module(s). FILE is the optional
205 pathname to the Apache apxs tool; defaults to "apxs".],
207 if test "$withval" = "yes"; then
208 for i in /usr/sbin /usr/local/apache/bin ; do
209 if test -f "$i/apxs"; then
213 if test -z "$APXS"; then
221 if test "$APXS" = "no"; then
223 # --without-apxs means you want the modules,
224 # but want to tell us how to build them
225 AC_MSG_RESULT(yes, but use environment, not apxs)
227 echo "Did you set one or more of these?"
229 echo "APXS_CFLAGS APXS_PREFIX APXS_INCLUDE APXS_LIBEXEC APXS_SYSCONFDIR"
232 AC_MSG_NOTICE([APXS_CFLAGS is $APXS_CFLAGS])
234 # try and find the Apache root
235 if test -z "$APXS_PREFIX"; then
236 if test -d "/usr/local/apache"; then
237 APXS_PREFIX="/usr/local/apache"
239 AC_MSG_ERROR([You MUST set APXS_PREFIX so the right Apache can be located!])
241 elif test ! -d "$APXS_PREFIX"; then
242 AC_MSG_ERROR([APXS_PREFIX of $APXS_PREFIX cannot be found])
244 AC_MSG_NOTICE([APXS_PREFIX is $APXS_PREFIX])
247 # other subfolders might be derived from APXS_PREFIX
248 if test -z "$APXS_INCLUDE"; then
249 if test -f "$APXS_PREFIX/include/httpd.h"; then
250 APXS_INCLUDE="$APXS_PREFIX/include"
252 AC_MSG_ERROR([can't find Apache include files beneath $APXS_PREFIX])
254 elif ! test -f "$APXS_INCLUDE/httpd.h"; then
255 AC_MSG_ERROR([APXS_INCLUDE of $APXS_INCLUDE does not contain Apache headers])
257 AC_MSG_NOTICE([APXS_INCLUDE is $APXS_INCLUDE])
259 if test -z "$APXS_LIBEXEC"; then
260 if test -d "$APXS_PREFIX/libexec"; then
261 APXS_LIBEXEC="$APXS_PREFIX/libexec"
262 elif test -d "$APXS_PREFIX/modules"; then
263 APXS_LIBEXEC="$APXS_PREFIX/modules"
265 AC_MSG_ERROR([can't find Apache libexec/module directory beneath $APXS_PREFIX])
267 elif ! test -d "$APXS_LIBEXEC"; then
268 AC_MSG_ERROR([APXS_LIBEXEC of $APXS_LIBEXEC does not exist])
270 AC_MSG_NOTICE([APXS_LIBEXEC is $APXS_LIBEXEC])
272 if test -z "$APXS_SYSCONFDIR"; then
273 if test -d "$APXS_PREFIX/conf"; then
274 APXS_SYSCONFDIR="$APXS_PREFIX/conf"
276 AC_MSG_ERROR([can't find Apache conf directory beneath $APXS_PREFIX])
278 elif ! test -d "$APXS_SYSCONFDIR"; then
279 AC_MSG_ERROR([APXS_SYSCONFDIR of $APXS_SYSCONFDIR does not exist])
281 AC_MSG_NOTICE([APXS_SYSCONFDIR is $APXS_SYSCONFDIR])
285 elif test -n "$APXS"; then
287 # extract settings we need from APXS -q
288 APXS_CC="`$APXS -q CC`"
289 APXS_CFLAGS="`$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
290 APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
291 APXS_LIBEXEC="`$APXS -q LIBEXECDIR`"
292 APXS_SYSCONFDIR="`$APXS -q SYSCONFDIR`"
295 AC_MSG_RESULT(found at $APXS)
297 if test -z "`$APXS -q LD_SHLIB`" || test "$APXS_LIBEXEC" = "modules"; then
299 [Your APXS installation is broken and cannot be used.
300 Please see http://www.webdav.org/mod_dav/install.html#apxs for
307 # guess we're not doing Apache 1.3
314 AM_CONDITIONAL(HAVE_APXS,test -n "$APXS")
316 if test "$WANT_APACHE" = "yes"; then
318 AC_HELP_STRING([--with-apreq=PATH], [where libapreq is installed]),
319 [if test x_$with_apreq != x_/usr; then
320 LDFLAGS="-L${with_apreq}/lib $LDFLAGS"
321 CPPFLAGS="-I${with_apreq}/include $CPPFLAGS"
324 saved_CPPFLAGS="$CPPFLAGS"
325 CPPFLAGS="-I$APXS_INCLUDE $APXS_CFLAGS $CPPFLAGS"
326 AC_TRY_COMPILE([#include <libapreq/apache_request.h>],
328 test_apreq="yes",test_apreq="no")
329 if test "$test_apreq" = "no"; then
330 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
331 APXS_CFLAGS="$APXS_CFLAGS -U_XOPEN_SOURCE"
332 AC_CHECK_HEADER([libapreq/apache_request.h],,
333 AC_MSG_ERROR([unable to find a usable libapreq header]))
336 dnl saved_LIBS="$LIBS"
337 dnl LIBS="-lapreq $LIBS"
339 dnl [#include <libapreq/apache_request.h>],
340 dnl [ApacheRequest_expires],
341 dnl [AC_DEFINE(HAVE_APREQ,1,[Define if apreq library was found])],
342 dnl [AC_MSG_ERROR([unable to link with apreq])
344 dnl LIBS="$saved_LIBS"
345 CPPFLAGS="$saved_CPPFLAGS"
347 AC_ARG_ENABLE([apxs-install],
348 AC_HELP_STRING([--enable-apxs-install],
349 [use apxs to install the apache modules]),
350 APXS_INSTALL="yes", )
353 AC_SUBST(APXS_CFLAGS)
354 AC_SUBST(APXS_INCLUDE)
355 AC_SUBST(APXS_LIBEXEC)
356 AC_SUBST(APXS_SYSCONFDIR)
358 # output the Apache 1.3 makefiles
359 WANT_SUBDIRS="$WANT_SUBDIRS mod_shire mod_shibrm"
361 # always output the Makefile, even if we don't use it
362 AC_CONFIG_FILES([mod_shire/Makefile mod_shibrm/Makefile])
364 AM_CONDITIONAL(DO_APXS_INSTALL,test -n "$APXS_INSTALL")
367 # Implement the checks of the MySQL Credential Cache
369 # 1) Assume the user wants MySQL; if it's not found then just continue without
370 # 2) If the user specifically requested Mysql, look for it and ERROR if not found
371 # 3) If the user specifically requested no-mysql, don't build it.
374 AC_CONFIG_FILES([shib-mysql-ccache/Makefile])
376 # determine whether we should enable the mysql ccache
377 AC_ARG_ENABLE([mysql],
378 AC_HELP_STRING([--disable-mysql], [disable the MySQL Credential Cache]),
379 [mysql_enabled=$enableval], [mysql_enabled=default])
381 if test "x$mysql_enabled" = "x" ; then
385 # Are we trying to build MySQL?
386 AC_MSG_CHECKING(whether to build the MySQL ccache)
387 if test "$mysql_enabled" = "yes" ; then
390 elif test "$mysql_enabled" = "default" ; then
392 AC_MSG_RESULT([yes, if it can be found])
398 # If we're trying to build MySQL, try to find the mysql_config program,
399 # verify we've got mysql >= 4, and make sure we can build with mysqld
400 if test "$build_mysql" = "yes" ; then
403 AC_HELP_STRING([--with-mysql=PATH], [directory where mysql is installed]),
404 [if test "$with_mysql" = no ; then
405 AC_MSG_ERROR([Try running --disable-mysql instead.])
406 elif test "$with_mysql" != yes ; then
407 mysql_dir="$with_mysql/bin"
410 # Try to find the mysql_config program
411 AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, $mysql_dir $PATH )
413 if test "$MYSQL_CONFIG" = no ; then
414 if test "$mysql_enabled" = "yes" ; then
415 AC_MSG_ERROR(Cannot find mysql_config)
417 AC_MSG_WARN(MySQL not found. skipping.)
422 # if we found mysql_config then build_mysql is 'yes'
423 if test "$MYSQL_CONFIG" != no ; then
424 AC_MSG_CHECKING(for mysql version >= 4)
425 mysql_version=`$MYSQL_CONFIG --version`
426 mysql_major_version=`echo $mysql_version | awk -F. '{print $1}'`
428 if test $mysql_major_version -lt 4 ; then
430 if test "$mysql_enabled" = "yes" ; then
431 AC_MSG_ERROR(You need MySQL version >= 4, found $mysql_version)
433 AC_MSG_RESULT(no.. skipping MySQL)
439 # if mysql_version_ok is 'yes', then we've made it this far.. ;)
440 if test "$mysql_version_ok" = "yes" ; then
441 AC_MSG_CHECKING(for embedded-MySQL libraries)
442 MYSQL_LIBS=`$MYSQL_CONFIG --libmysqld-libs`
443 if test $? != 0 ; then
445 if test "$mysql_enabled" = "yes" ; then
446 AC_MSG_ERROR(Could not find the MySQL Embedded-server libraries.)
448 AC_MSG_RESULT(no.. skipping MySQL)
456 # if found_mysql=yes then test that we can actually build mysql
457 if test "$found_mysql" = yes ; then
458 MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
459 MYSQL_CFLAGS=`eval echo $MYSQL_CFLAGS`
460 MYSQL_LIBS=`eval echo $MYSQL_LIBS`
462 save_CPPFLAGS="$CPPFLAGS"
463 CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS"
465 AC_CHECK_HEADER([mysql.h], [have_mysql_h=yes], [have_mysql_h=no])
466 if test "$have_mysql_h" = no -a "$mysql_enabled" = "yes" ; then
467 AC_MSG_ERROR(unable to find MySQL header files)
470 if test "$have_mysql_h" = yes ; then
472 LIBS="$LIBS $MYSQL_LIBS"
473 AC_MSG_CHECKING(if we can link againt mysql)
475 [#include <mysql.h>],
476 [mysql_server_init(0, NULL, NULL)],
477 [have_mysql_libs=yes],
478 [have_mysql_libs=no])
481 if test "$have_mysql_libs" = no ; then
482 if "$mysql_enabled" = "yes" ; then
483 AC_MSG_ERROR([unable to link with MySQL Embedded Server Library])
485 AC_MSG_RESULT(no. skipping MySQL)
490 CPPFLAGS="$save_CPPFLAGS"
493 # if have_mysql_libs=yes then go ahead with building MySQL
494 if test "$have_mysql_libs" = yes ; then
495 # this AC_MSG_RESULT is from above!
497 WANT_SUBDIRS="$WANT_SUBDIRS shib-mysql-ccache"
498 AC_SUBST(MYSQL_CFLAGS)
503 AC_SUBST(WANT_SUBDIRS)
505 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
506 echo "=================================================================="
507 echo "WARNING: You have chosen to compile Apache modules with a different"
508 echo " compiler than the one used to compile Apache."
510 echo " Current compiler: $CC"
511 echo " Apache's compiler: $APXS_CC"
513 echo "This could cause some problems."
514 echo "=================================================================="