2 AC_INIT([shibboleth], [2.0], [shibboleth-users@internet2.edu], [shibboleth])
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE([shibboleth],[2.0])
6 sinclude(acx_pthread.m4)
9 AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)
11 enable_debug=$enableval, enable_debug=no)
13 if test "$enable_debug" = "yes" ; then
14 GCC_CFLAGS="$CFLAGS -Wall -g -D_DEBUG"
15 GCC_CXXFLAGS="$CXXFLAGS -Wall -g -D_DEBUG"
17 GCC_CFLAGS="$CFLAGS -Wall -O2 -DNDEBUG"
18 GCC_CXXFLAGS="$CXXFLAGS -Wall -O2 -DNDEBUG"
21 AC_PROG_CC([gcc gcc3 cc])
22 AC_PROG_CXX([g++ g++3 c++ CC])
24 if test "$GCC" = "yes" ; then
26 CXXFLAGS="$GCC_CXXFLAGS"
40 # Checks for typedefs, structures, and compiler characteristics.
45 # Checks for library functions.
48 AC_CHECK_FUNCS([strchr strdup strstr gmtime_r ctime_r strtok_r strcasecmp])
49 AC_CHECK_HEADERS([dlfcn.h])
52 # AC_SEARCH_LIBS(xdr_uint64_t,nsl,,
53 # [CFLAGS="$CFLAGS -DNEED_XDR_LONGLONG"
54 # CXXFLAGS="$CXXFLAGS -DNEED_XDR_LONGLONG"])
58 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
59 if test $enable_threads != "pthread"; then
60 AC_MSG_ERROR([unable to find pthreads, currently this is required])
62 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
63 LIBS="$PTHREAD_LIBS $LIBS"
64 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
65 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
69 AC_HELP_STRING([--with-dmalloc=PATH], [where dmalloc is installed]),
70 [if test x_$with_dmalloc != x_/usr; then
71 LDFLAGS="-L${with_dmalloc}/lib $LDFLAGS"
72 CPPFLAGS="-I${with_dmalloc}/include $CPPFLAGS"
74 AC_CHECK_LIB(dmallocxx, dmalloc_shutdown,,
75 AC_MSG_ERROR([unable to find dmallocxx library]))
79 AC_PATH_PROG(PKG_CONFIG, pkg-config)
80 if test "x$PKG_CONFIG" = x || test "x$PKG_CONFIG" = "xno" ; then
82 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
83 [if test x_$with_openssl != x_/usr; then
84 SSLLIBS="-L${with_openssl}/lib"
85 SSLFLAGS="-I${with_openssl}/include"
87 SSLLIBS="$SSLLIBS -lssl -lcrypto"
89 SSLLIBS="`$PKG_CONFIG --libs openssl`"
90 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
92 AC_MSG_CHECKING(for OpenSSL libraries)
93 AC_MSG_RESULT($SSLLIBS)
95 AC_MSG_CHECKING(for OpenSSL cflags)
96 AC_MSG_RESULT($SSLFLAGS)
97 CPPFLAGS="$SSLFLAGS $CPPFLAGS"
99 AC_CHECK_HEADER([openssl/ssl.h],,
100 AC_MSG_ERROR([unable to find openssl header files]))
101 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
102 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
103 AC_MSG_ERROR([unable to link with openssl libraries]))
105 AC_MSG_CHECKING(for SSL_library_init)
106 AC_TRY_LINK_FUNC([SSL_library_init],,
107 AC_MSG_ERROR([unable to link with openssl libraries]))
113 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
115 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp is installed]),
116 [LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"])
117 if test -f "${LOG4CPP_CONFIG}"; then
118 LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
119 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
121 AC_MSG_WARN([log4cpp-config not found, guessing at log4cpp build settings])
122 LIBS="-llog4cpp $LIBS"
124 AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
126 [#include <log4cpp/Category.hh>],
127 [log4cpp::Category::getInstance("foo")],
128 [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])],
129 [AC_MSG_ERROR([unable to link with log4cpp])])
133 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
134 [if test x_$with_xerces != x_/usr; then
135 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
136 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
138 LIBS="-lxerces-c $LIBS"
139 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,
140 AC_MSG_ERROR([unable to find xerces header files]))
141 AC_MSG_CHECKING([Xerces version])
143 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
144 [#if _XERCES_VERSION > 20200 && _XERCES_VERSION != 20600
147 #error requires version > 2.2.0 but not 2.6.0
150 [AC_MSG_ERROR([Shibboleth requires patched Xerces version 2.6.1 (http://shibboleth.internet2.edu/downloads/)])])
152 [#include <xercesc/util/PlatformUtils.hpp>],
153 [xercesc::XMLPlatformUtils::Initialize()],
154 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
155 [AC_MSG_ERROR([unable to link with Xerces])])
158 # XML-Security settings
160 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
161 [if test x_$with_xmlsec != x_/usr; then
162 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
163 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
165 LIBS="-lxml-security-c $LIBS"
166 AC_CHECK_HEADER([xsec/xenc/XENCEncryptionMethod.hpp],,AC_MSG_ERROR([unable to find xml-security 1.1 header files]),[#include <xercesc/dom/DOM.hpp>])
168 [#include <xsec/utils/XSECPlatformUtils.hpp>],
169 [XSECPlatformUtils::Initialise()],
170 [AC_DEFINE(HAVE_LIBXSEC,1,[Define if XML-Sec library was found])],
171 [AC_MSG_ERROR([unable to link with xml-security])])
175 AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
176 [if test x_$with_saml != x_/usr; then
177 LDFLAGS="-L${with_saml}/lib $LDFLAGS"
178 CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
180 AC_CHECK_HEADER([saml/saml.h],,
181 AC_MSG_ERROR([unable to find saml header files]))
184 [#include <saml/saml.h>
185 #include <saml/version.h>],
186 [#if _OPENSAML_VERSION >= 20000
187 opensaml::SAMLConfig::getConfig();
189 #error Need OpenSAML version 2.0 or higher
191 [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])],
192 [AC_MSG_ERROR([unable to link with saml, or version too old])])
194 # output the underlying makefiles
195 WANT_SUBDIRS="doc schemas configs shibsp shibd siterefresh test"
196 AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
197 configs/Makefile shibsp/Makefile shibd/Makefile siterefresh/Makefile \
198 test/Makefile selinux/Makefile])
202 # Build NSAPI module?
204 AC_MSG_CHECKING(for NSAPI module option)
206 AC_HELP_STRING([--with-nsapi=DIR], [Build NSAPI module for Netscape/iPlanet/SunONE]),
207 [WANT_NSAPI=$withval],[WANT_NSAPI=no])
208 AC_MSG_RESULT($WANT_NSAPI)
210 if test "$WANT_NSAPI" != "no"; then
211 if test ! -d $WANT_NSAPI/bin ; then
212 AC_MSG_ERROR(Please specify the path to the root of your Netscape/iPlanet/SunONE server using --with-nsapi=DIR)
214 AC_MSG_CHECKING(for NSAPI include files)
215 if test -d $WANT_NSAPI/include ; then
216 NSAPI_INCLUDE=$WANT_NSAPI/include
217 AC_MSG_RESULT(Netscape-Enterprise 3.x style)
218 AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
219 NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
221 if test -d $WANT_NSAPI/plugins/include ; then
222 test -n "$NSAPI_INCLUDE" && NSAPI_INC_DIR="-I$NSAPI_INCLUDE"
223 NSAPI_INCLUDE="$WANT_NSAPI/plugins/include"
224 AC_MSG_RESULT(iPlanet 4.x / SunONE 6.x style)
225 AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
226 NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
228 if test "$NSAPI_INCLUDE" = ""; then
229 AC_MSG_ERROR(Please check you have nsapi.h in either $WANT_NSAPI/include or $WANT_NSAPI/plugins/include)
233 AC_SUBST(NSAPI_INCLUDE)
235 # always output the Makefile, even if you don't use it
236 AC_CONFIG_FILES([nsapi_shib/Makefile])
237 AM_CONDITIONAL(BUILD_NSAPI,test ! "$WANT_NSAPI" = "no")
239 # add the NSAPI module to the list of wanted subdirs..
240 if test ! "$WANT_NSAPI" = "no" ; then
241 WANT_SUBDIRS="$WANT_SUBDIRS nsapi_shib"
245 # Apache 1.3 (mod_shib_13)
247 # --with-apxs (DSO build, the normal way, uses apxs to derive build flags)
249 AC_ARG_ENABLE(apache-13,
250 AC_HELP_STRING([--enable-apache-13], [enable the Apache 1.3 module]),
251 [ if test "x$enableval" = "x" ; then
254 WANT_APACHE_13="$enableval"
256 ],[ WANT_APACHE_13=no ])
257 AC_MSG_CHECKING(whether to build Apache 1.3 module)
258 if test "$WANT_APACHE_13" != yes && test "$WANT_APACHE_13" != no ; then
261 AC_MSG_RESULT($WANT_APACHE_13)
263 if test "$WANT_APACHE_13" = "yes" ; then
265 AC_HELP_STRING([--with-apxs=FILE], [Specifies where to find the Apache 1.3 apxs script.]),
267 AC_MSG_CHECKING(for user-specified apxs name/location)
268 if test "$withval" != "no" ; then
269 if test "$withval" != "yes"; then
271 AC_MSG_RESULT("$withval")
276 AC_PATH_PROG(APXS, apxs, no)
277 if test "$APXS" = "no" ; then
278 for i in /usr/sbin /usr/local/apache/bin ; do
279 if test "$APXS" = "no" && test -f "$i/apxs"; then
286 AC_MSG_CHECKING([to see if apxs was located])
287 if test ! -f "$APXS" ; then
289 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.])
294 # extract settings we need from APXS -q
295 APXS_CC="`$APXS -q CC`"
296 APXS_CFLAGS="`$APXS -q CPPFLAGS` `$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
297 APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
300 AC_SUBST(APXS_CFLAGS)
301 AC_SUBST(APXS_INCLUDE)
304 # Apache 2.0 (mod_shib_20)
306 # --with-apxs2 (DSO build, the normal way, uses apxs to derive build flags)
307 # --with-apr (DSO build, APR development package installed separately)
309 AC_ARG_ENABLE(apache-20,
310 AC_HELP_STRING([--enable-apache-20], [enable the Apache 2.0 module]),
311 [ if test "x$enableval" = "x" ; then
314 WANT_APACHE_20="$enableval"
316 ],[ WANT_APACHE_20=no ])
317 AC_MSG_CHECKING(whether to build Apache 2.0 module)
318 if test "$WANT_APACHE_20" != yes && test "$WANT_APACHE_20" != no ; then
321 AC_MSG_RESULT($WANT_APACHE_20)
323 if test "$WANT_APACHE_20" = "yes" ; then
325 AC_HELP_STRING([--with-apxs2=FILE], [Specifies where to find the Apache 2.0 apxs script.]),
327 AC_MSG_CHECKING(for user-specified Apache2 apxs name/location)
328 if test "$withval" != "no" ; then
329 if test "$withval" != "yes"; then
331 AC_MSG_RESULT("$withval")
336 AC_PATH_PROG(APXS2, apxs2, no)
337 if test "$APXS2" = "no" ; then
338 AC_PATH_PROG(APXS2, apxs, no)
340 if test "$APXS2" = "no" ; then
341 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
342 if test "$APXS2" = "no" && test -f "$i/apxs2" ; then
346 if test "$APXS2" = "no" ; then
347 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
348 if test "$APXS2" = "no" && test -f "$i/apxs" ; then
356 AC_MSG_CHECKING([to see if Apache2 apxs was located])
357 if test ! -f "$APXS2" ; then
359 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.])
361 AC_MSG_RESULT($APXS2)
366 AC_HELP_STRING([--with-apr=PATH], [where apr-config is installed]),
368 AC_MSG_CHECKING(for user-specified apr-config name/location)
369 if test "$withval" != "no" ; then
370 if test "$withval" != "yes"; then
372 AC_MSG_RESULT("$withval")
377 AC_PATH_PROG(APR_CONFIG, apr-config)
379 if test -f "${APR_CONFIG}"; then
380 APR_CFLAGS="`${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags` `${APR_CONFIG} --includes`"
382 AC_MSG_ERROR([Unable to locate apr-config, may need --with-apr option.])
385 # extract settings we need from APXS2 -q
386 APXS2_CC="`$APXS2 -q CC`"
387 APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` `$APXS2 -q CFLAGS_SHLIB` $APR_CFLAGS"
388 APXS2_INCLUDE="`$APXS2 -q INCLUDEDIR`"
391 AC_SUBST(APXS2_CFLAGS)
392 AC_SUBST(APXS2_INCLUDE)
395 # Apache 2.2 (mod_shib_22)
397 # --with-apxs22 (DSO build, the normal way, uses apxs to derive build flags)
398 # --with-apr1 (DSO build, APR development package installed separately)
400 AC_ARG_ENABLE(apache-22,
401 AC_HELP_STRING([--enable-apache-22], [enable the Apache 2.2 module]),
402 [ if test "x$enableval" = "x" ; then
405 WANT_APACHE_22="$enableval"
407 ],[ WANT_APACHE_22=no ])
408 AC_MSG_CHECKING(whether to build Apache 2.2 module)
409 if test "$WANT_APACHE_22" != yes && test "$WANT_APACHE_22" != no ; then
412 AC_MSG_RESULT($WANT_APACHE_22)
414 if test "$WANT_APACHE_22" = "yes" ; then
416 AC_HELP_STRING([--with-apxs22=FILE], [Specifies where to find the Apache 2.2 apxs script.]),
418 AC_MSG_CHECKING(for user-specified Apache2.2 apxs name/location)
419 if test "$withval" != "no" ; then
420 if test "$withval" != "yes"; then
422 AC_MSG_RESULT("$withval")
427 AC_PATH_PROG(APXS22, apxs2, no)
428 if test "$APXS22" = "no" ; then
429 AC_PATH_PROG(APXS22, apxs, no)
431 if test "$APXS22" = "no" ; then
432 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
433 if test "$APXS22" = "no" && test -f "$i/apxs2" ; then
437 if test "$APXS22" = "no" ; then
438 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
439 if test "$APXS22" = "no" && test -f "$i/apxs" ; then
447 AC_MSG_CHECKING([to see if Apache2.2 apxs was located])
448 if test ! -f "$APXS22" ; then
450 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.])
452 AC_MSG_RESULT($APXS22)
457 AC_HELP_STRING([--with-apr1=PATH], [where apr-1-config is installed]),
459 AC_MSG_CHECKING(for user-specified apr-1-config name/location)
460 if test "$withval" != "no" ; then
461 if test "$withval" != "yes"; then
463 AC_MSG_RESULT("$withval")
468 AC_PATH_PROG(APR1_CONFIG, apr-1-config)
470 if test -f "${APR1_CONFIG}"; then
471 APR1_CFLAGS="`${APR1_CONFIG} --cflags` `${APR1_CONFIG} --cppflags` `${APR1_CONFIG} --includes`"
473 AC_MSG_ERROR([Unable to locate apr-1-config, may need --with-apr1 option.])
476 # extract settings we need from APXS22 -q
477 APXS22_CC="`$APXS22 -q CC`"
478 APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` `$APXS22 -q CFLAGS_SHLIB` $APR1_CFLAGS"
479 APXS22_INCLUDE="`$APXS22 -q INCLUDEDIR`"
482 AC_SUBST(APXS22_CFLAGS)
483 AC_SUBST(APXS22_INCLUDE)
485 # always output the Makefile, even if you don't use it
486 AC_CONFIG_FILES([apache/Makefile])
487 AM_CONDITIONAL(BUILD_AP13,test "$WANT_APACHE_13" = "yes")
488 AM_CONDITIONAL(BUILD_AP20,test "$WANT_APACHE_20" = "yes")
489 AM_CONDITIONAL(BUILD_AP22,test "$WANT_APACHE_22" = "yes")
491 # add the apache module to the list of wanted subdirs..
492 if test "$WANT_APACHE_13" = "yes" || test "$WANT_APACHE_20" = "yes" || test "$WANT_APACHE_22" = "yes" ; then
493 WANT_SUBDIRS="$WANT_SUBDIRS apache"
498 # Implement the checks of the ODBC Credential Cache
500 # 1) Assume the user wants ODBC; if it's not found then just continue without
501 # 2) If the user specifically requested odbc, look for it and ERROR if not found
502 # 3) If the user specifically requested no-odbc, don't build it.
505 AC_CONFIG_FILES([odbc_ccache/Makefile])
507 # determine whether we should enable the odbc ccache
508 AC_ARG_ENABLE([odbc],
509 AC_HELP_STRING([--disable-odbc], [disable the ODBC Credential Cache]),
510 [odbc_enabled=$enableval], [odbc_enabled=default])
512 if test "x$odbc_enabled" = "x" ; then
516 # Are we trying to build ODBC?
517 AC_MSG_CHECKING(whether to build the ODBC ccache)
518 if test "$odbc_enabled" = "yes" ; then
521 elif test "$odbc_enabled" = "default" ; then
523 AC_MSG_RESULT([yes, if it can be found])
529 # If we're trying to build ODBC, try to find the odbc_config program.
530 if test "$build_odbc" = "yes" ; then
533 AC_HELP_STRING([--with-odbc=PATH], [directory where odbc is installed]),
534 [if test "$with_odbc" = no ; then
535 AC_MSG_ERROR([Try running --disable-odbc instead.])
536 elif test "$with_odbc" != yes ; then
537 odbc_dir="$with_odbc/bin"
540 # Try to find the mysql_config program
541 AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
543 if test "$ODBC_CONFIG" = no ; then
544 if test "$odbc_enabled" = "yes" ; then
545 AC_MSG_ERROR(Cannot find odbc_config)
547 AC_MSG_WARN(ODBC not found, skipping.)
552 if test "$build_odbc" = yes ; then
553 ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
554 ODBC_CFLAGS=`eval echo $ODBC_CFLAGS`
555 ODBC_LIBS=`$ODBC_CONFIG --libs`
556 ODBC_LIBS=`eval echo $ODBC_LIBS`
558 save_CPPFLAGS="$CPPFLAGS"
559 CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
561 AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
562 if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
563 AC_MSG_ERROR(unable to find ODBC header files)
566 if test "$have_sql_h" = yes ; then
568 LIBS="$LIBS $ODBC_LIBS"
569 AC_MSG_CHECKING(if we can link againt ODBC)
574 [SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)],
575 [have_odbc_libs=yes],
579 if test "$have_odbc_libs" = no ; then
580 if test "$odbc_enabled" = "yes" ; then
581 AC_MSG_ERROR([unable to link with ODBC Library])
583 AC_MSG_RESULT(no, skipping ODBC)
588 CPPFLAGS="$save_CPPFLAGS"
591 # if have_odbc_libs=yes then go ahead with building ODBC
592 if test "$have_odbc_libs" = yes ; then
593 # this AC_MSG_RESULT is from above!
595 WANT_SUBDIRS="$WANT_SUBDIRS odbc_ccache"
596 AC_SUBST(ODBC_CFLAGS)
601 AC_SUBST(WANT_SUBDIRS)
603 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
604 echo "=================================================================="
605 echo "WARNING: You have chosen to compile Apache-1.3 modules with a different"
606 echo " compiler than the one used to compile Apache."
608 echo " Current compiler: $CC"
609 echo " Apache's compiler: $APXS_CC"
611 echo "This could cause problems."
612 echo "=================================================================="
615 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
616 echo "=================================================================="
617 echo "WARNING: You have chosen to compile Apache-2 modules with a different"
618 echo " compiler than the one used to compile Apache."
620 echo " Current compiler: $CC"
621 echo " Apache's compiler: $APXS2_CC"
623 echo "This could cause problems."
624 echo "=================================================================="
627 LIBTOOL="$LIBTOOL --silent"