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])
51 # AC_SEARCH_LIBS(xdr_uint64_t,nsl,,
52 # [CFLAGS="$CFLAGS -DNEED_XDR_LONGLONG"
53 # CXXFLAGS="$CXXFLAGS -DNEED_XDR_LONGLONG"])
57 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
58 if test $enable_threads != "pthread"; then
59 AC_MSG_ERROR([unable to find pthreads, currently this is required])
61 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
62 LIBS="$PTHREAD_LIBS $LIBS"
63 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
64 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
70 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
72 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp is installed]),
73 [LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"])
74 if test -f "${LOG4CPP_CONFIG}"; then
75 LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
76 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
78 AC_MSG_WARN([log4cpp-config not found, guessing at log4cpp build settings])
79 LIBS="-llog4cpp $LIBS"
81 AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
83 [#include <log4cpp/Category.hh>],
84 [log4cpp::Category::getInstance("foo")],
85 [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])],
86 [AC_MSG_ERROR([unable to link with log4cpp])])
90 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
91 [if test x_$with_xerces != x_/usr; then
92 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
93 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
95 LIBS="-lxerces-c $LIBS"
96 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,
97 AC_MSG_ERROR([unable to find xerces header files]))
98 AC_MSG_CHECKING([Xerces version])
100 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
101 [#if _XERCES_VERSION != 20600
104 #error cannot use version 2.6.0
107 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
109 [#include <xercesc/util/PlatformUtils.hpp>],
110 [xercesc::XMLPlatformUtils::Initialize()],
111 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
112 [AC_MSG_ERROR([unable to link with Xerces])])
115 # XML-Security settings
117 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
120 if test x_$with_xmlsec != x_/usr; then
121 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
122 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
124 LIBS="-lxml-security-c $LIBS"
125 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
126 AC_MSG_CHECKING([XML-Security version])
128 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
129 [#if XSEC_VERSION_MAJOR > 1 || XSEC_VERSION_MEDIUM >2
132 #error need version 1.3 or later
135 [AC_MSG_FAILURE([XML-Security version 1.3 or greater is required.])])
137 [#include <xsec/utils/XSECPlatformUtils.hpp>],
138 [XSECPlatformUtils::Initialise()],,
139 [AC_MSG_ERROR([unable to link with XML-Sec])])
143 AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
144 [if test x_$with_saml != x_/usr; then
145 LDFLAGS="-L${with_saml}/lib $LDFLAGS"
146 CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
148 AC_CHECK_HEADER([saml/saml.h],,
149 AC_MSG_ERROR([unable to find saml header files]))
152 [#include <saml/saml.h>
153 #include <saml/version.h>],
154 [#if _OPENSAML_VERSION >= 20000
155 opensaml::SAMLConfig::getConfig();
157 #error Need OpenSAML version 2.0 or higher
159 [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])],
160 [AC_MSG_ERROR([unable to link with OpenSAML, or version was too old])])
162 # output the underlying makefiles
163 WANT_SUBDIRS="doc schemas configs shibsp shibd siterefresh test"
164 AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
165 configs/Makefile shibsp/Makefile shibd/Makefile siterefresh/Makefile \
166 util/Makefile selinux/Makefile])
170 # Build NSAPI module?
172 AC_MSG_CHECKING(for NSAPI module option)
174 AC_HELP_STRING([--with-nsapi=DIR], [Build NSAPI module for Netscape/iPlanet/SunONE]),
175 [WANT_NSAPI=$withval],[WANT_NSAPI=no])
176 AC_MSG_RESULT($WANT_NSAPI)
178 if test "$WANT_NSAPI" != "no"; then
179 if test ! -d $WANT_NSAPI/bin ; then
180 AC_MSG_ERROR(Please specify the path to the root of your Netscape/iPlanet/SunONE server using --with-nsapi=DIR)
182 AC_MSG_CHECKING(for NSAPI include files)
183 if test -d $WANT_NSAPI/include ; then
184 NSAPI_INCLUDE=$WANT_NSAPI/include
185 AC_MSG_RESULT(Netscape-Enterprise 3.x style)
186 AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
187 NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
189 if test -d $WANT_NSAPI/plugins/include ; then
190 test -n "$NSAPI_INCLUDE" && NSAPI_INC_DIR="-I$NSAPI_INCLUDE"
191 NSAPI_INCLUDE="$WANT_NSAPI/plugins/include"
192 AC_MSG_RESULT(iPlanet 4.x / SunONE 6.x style)
193 AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
194 NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
196 if test "$NSAPI_INCLUDE" = ""; then
197 AC_MSG_ERROR(Please check you have nsapi.h in either $WANT_NSAPI/include or $WANT_NSAPI/plugins/include)
201 AC_SUBST(NSAPI_INCLUDE)
203 # always output the Makefile, even if you don't use it
204 AC_CONFIG_FILES([nsapi_shib/Makefile])
205 AM_CONDITIONAL(BUILD_NSAPI,test ! "$WANT_NSAPI" = "no")
207 # add the NSAPI module to the list of wanted subdirs..
208 if test ! "$WANT_NSAPI" = "no" ; then
209 WANT_SUBDIRS="$WANT_SUBDIRS nsapi_shib"
213 # If no --enable-apache-xx specified
214 # find a default and fake the specific parameters
217 # simple macro to peek at an enable or a with
219 if test "[${[$1]_][$2]+set}" = set; then
220 peekval="${[$1]_[$2]}"
225 AC_MSG_CHECKING(if default apache needed)
227 Peek(enable,apache_13,need_default=no)
228 Peek(enable,apache_20,need_default=no)
229 Peek(enable,apache_22,need_default=no)
230 AC_MSG_RESULT($need_default)
232 if test "$need_default" = "yes"; then
233 # find an apxs, then the httpd
235 Peek(with,apxs,xs="$peekval")
236 Peek(with,apxs2,xs="$peekval")
237 Peek(with,apxs22,xs="$peekval")
238 if test "x$xs" = "x"; then
239 AC_PATH_PROGS(xs, apxs2 apxs,
240 AC_MSG_ERROR(No apxs, no apache found. Try --with-apxs),
241 [/usr/local/apache2/bin:/usr/local/apache/bin:/usr/sbin:$PATH])
243 # ask the daemon for the version and set parameters
244 AC_MSG_CHECKING(default apache version)
245 httpd="`$xs -q SBINDIR`/`$xs -q TARGET`"
246 if test "x$httpd" != "x"; then
247 v=`$httpd -v|$SED -n -e 's/.*Apache\/\.*//p'`
249 1.3*) [enable_apache_13]=yes
253 2.0*) [enable_apache_20]=yes
257 2.2*) [enable_apache_22]=yes
261 *) AC_MSG_ERROR(unusable apache versions: $v. Try setting --with-apxs)
264 AC_MSG_RESULT(cannot determine version. Try setting --with-apxs)
268 # Apache 1.3 (mod_shib_13)
270 # --with-apxs (DSO build, the normal way, uses apxs to derive build flags)
272 AC_ARG_ENABLE(apache-13,
273 AC_HELP_STRING([--enable-apache-13], [enable the Apache 1.3 module]),
274 [ if test "x$enableval" = "x" ; then
277 WANT_APACHE_13="$enableval"
279 ],[ WANT_APACHE_13=no ])
280 AC_MSG_CHECKING(whether to build Apache 1.3 module)
281 if test "$WANT_APACHE_13" != yes && test "$WANT_APACHE_13" != no ; then
284 AC_MSG_RESULT($WANT_APACHE_13)
286 if test "$WANT_APACHE_13" = "yes" ; then
288 AC_HELP_STRING([--with-apxs=FILE], [Specifies where to find the Apache 1.3 apxs script.]),
290 AC_MSG_CHECKING(for user-specified apxs name/location)
291 if test "$withval" != "no" ; then
292 if test "$withval" != "yes"; then
294 AC_MSG_RESULT("$withval")
299 AC_PATH_PROG(APXS, apxs, no)
300 if test "$APXS" = "no" ; then
301 for i in /usr/sbin /usr/local/apache/bin ; do
302 if test "$APXS" = "no" && test -f "$i/apxs"; then
309 AC_MSG_CHECKING([to see if apxs was located])
310 if test ! -f "$APXS" ; then
312 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.])
317 # extract settings we need from APXS -q
318 APXS_CC="`$APXS -q CC`"
319 APXS_CFLAGS="`$APXS -q CPPFLAGS` `$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
320 APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
323 AC_SUBST(APXS_CFLAGS)
324 AC_SUBST(APXS_INCLUDE)
327 # Apache 2.0 (mod_shib_20)
329 # --with-apxs2 (DSO build, the normal way, uses apxs to derive build flags)
330 # --with-apr (DSO build, APR development package installed separately)
332 AC_ARG_ENABLE(apache-20,
333 AC_HELP_STRING([--enable-apache-20], [enable the Apache 2.0 module]),
334 [ if test "x$enableval" = "x" ; then
337 WANT_APACHE_20="$enableval"
339 ],[ WANT_APACHE_20=no ])
340 AC_MSG_CHECKING(whether to build Apache 2.0 module)
341 if test "$WANT_APACHE_20" != yes && test "$WANT_APACHE_20" != no ; then
344 AC_MSG_RESULT($WANT_APACHE_20)
346 if test "$WANT_APACHE_20" = "yes" ; then
348 AC_HELP_STRING([--with-apxs2=FILE], [Specifies where to find the Apache 2.0 apxs script.]),
350 AC_MSG_CHECKING(for user-specified Apache2 apxs name/location)
351 if test "$withval" != "no" ; then
352 if test "$withval" != "yes"; then
354 AC_MSG_RESULT("$withval")
359 AC_PATH_PROG(APXS2, apxs2, no)
360 if test "$APXS2" = "no" ; then
361 AC_PATH_PROG(APXS2, apxs, no)
363 if test "$APXS2" = "no" ; then
364 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
365 if test "$APXS2" = "no" && test -f "$i/apxs2" ; then
369 if test "$APXS2" = "no" ; then
370 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
371 if test "$APXS2" = "no" && test -f "$i/apxs" ; then
379 AC_MSG_CHECKING([to see if Apache2 apxs was located])
380 if test ! -f "$APXS2" ; then
382 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.])
384 AC_MSG_RESULT($APXS2)
389 AC_HELP_STRING([--with-apr=PATH], [where apr-config is installed]),
391 AC_MSG_CHECKING(for user-specified apr-config name/location)
392 if test "$withval" != "no" ; then
393 if test "$withval" != "yes"; then
395 AC_MSG_RESULT("$withval")
400 AC_PATH_PROG(APR_CONFIG, apr-config)
402 if test -f "${APR_CONFIG}"; then
403 APR_CFLAGS="`${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags` `${APR_CONFIG} --includes`"
405 AC_MSG_ERROR([Unable to locate apr-config, may need --with-apr option.])
408 # extract settings we need from APXS2 -q
409 APXS2_CC="`$APXS2 -q CC`"
410 APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` `$APXS2 -q CFLAGS_SHLIB` $APR_CFLAGS"
411 APXS2_INCLUDE="`$APXS2 -q INCLUDEDIR`"
414 AC_SUBST(APXS2_CFLAGS)
415 AC_SUBST(APXS2_INCLUDE)
418 # Apache 2.2 (mod_shib_22)
420 # --with-apxs22 (DSO build, the normal way, uses apxs to derive build flags)
421 # --with-apr1 (DSO build, APR development package installed separately)
423 AC_ARG_ENABLE(apache-22,
424 AC_HELP_STRING([--enable-apache-22], [enable the Apache 2.2 module]),
425 [ if test "x$enableval" = "x" ; then
428 WANT_APACHE_22="$enableval"
430 ],[ WANT_APACHE_22=no ])
431 AC_MSG_CHECKING(whether to build Apache 2.2 module)
432 if test "$WANT_APACHE_22" != yes && test "$WANT_APACHE_22" != no ; then
435 AC_MSG_RESULT($WANT_APACHE_22)
437 if test "$WANT_APACHE_22" = "yes" ; then
439 AC_HELP_STRING([--with-apxs22=FILE], [Specifies where to find the Apache 2.2 apxs script.]),
441 AC_MSG_CHECKING(for user-specified Apache2.2 apxs name/location)
442 if test "$withval" != "no" ; then
443 if test "$withval" != "yes"; then
445 AC_MSG_RESULT("$withval")
450 AC_PATH_PROG(APXS22, apxs2, no)
451 if test "$APXS22" = "no" ; then
452 AC_PATH_PROG(APXS22, apxs, no)
454 if test "$APXS22" = "no" ; then
455 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
456 if test "$APXS22" = "no" && test -f "$i/apxs2" ; then
460 if test "$APXS22" = "no" ; then
461 for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
462 if test "$APXS22" = "no" && test -f "$i/apxs" ; then
470 AC_MSG_CHECKING([to see if Apache2.2 apxs was located])
471 if test ! -f "$APXS22" ; then
473 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.])
475 AC_MSG_RESULT($APXS22)
480 AC_HELP_STRING([--with-apr1=PATH], [where apr-1-config is installed]),
482 AC_MSG_CHECKING(for user-specified apr-1-config name/location)
483 if test "$withval" != "no" ; then
484 if test "$withval" != "yes"; then
486 AC_MSG_RESULT("$withval")
491 AC_PATH_PROG(APR1_CONFIG, apr-1-config)
493 if test -f "${APR1_CONFIG}"; then
494 APR1_CFLAGS="`${APR1_CONFIG} --cflags` `${APR1_CONFIG} --cppflags` `${APR1_CONFIG} --includes`"
496 AC_MSG_ERROR([Unable to locate apr-1-config, may need --with-apr1 option.])
499 # extract settings we need from APXS22 -q
500 APXS22_CC="`$APXS22 -q CC`"
501 APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` `$APXS22 -q CFLAGS_SHLIB` $APR1_CFLAGS"
502 APXS22_INCLUDE="`$APXS22 -q INCLUDEDIR`"
505 AC_SUBST(APXS22_CFLAGS)
506 AC_SUBST(APXS22_INCLUDE)
508 # always output the Makefile, even if you don't use it
509 AC_CONFIG_FILES([apache/Makefile])
510 AM_CONDITIONAL(BUILD_AP13,test "$WANT_APACHE_13" = "yes")
511 AM_CONDITIONAL(BUILD_AP20,test "$WANT_APACHE_20" = "yes")
512 AM_CONDITIONAL(BUILD_AP22,test "$WANT_APACHE_22" = "yes")
514 # add the apache module to the list of wanted subdirs..
515 if test "$WANT_APACHE_13" = "yes" || test "$WANT_APACHE_20" = "yes" || test "$WANT_APACHE_22" = "yes" ; then
516 WANT_SUBDIRS="$WANT_SUBDIRS apache"
521 # Implement the checks of the ODBC Credential Cache
523 # 1) Assume the user wants ODBC; if it's not found then just continue without
524 # 2) If the user specifically requested odbc, look for it and ERROR if not found
525 # 3) If the user specifically requested no-odbc, don't build it.
528 AC_CONFIG_FILES([odbc_ccache/Makefile])
530 # determine whether we should enable the odbc ccache
531 AC_ARG_ENABLE([odbc],
532 AC_HELP_STRING([--disable-odbc], [disable the ODBC Credential Cache]),
533 [odbc_enabled=$enableval], [odbc_enabled=default])
535 if test "x$odbc_enabled" = "x" ; then
539 # Are we trying to build ODBC?
540 AC_MSG_CHECKING(whether to build the ODBC ccache)
541 if test "$odbc_enabled" = "yes" ; then
544 elif test "$odbc_enabled" = "default" ; then
546 AC_MSG_RESULT([yes, if it can be found])
552 # If we're trying to build ODBC, try to find the odbc_config program.
553 if test "$build_odbc" = "yes" ; then
556 AC_HELP_STRING([--with-odbc=PATH], [directory where odbc is installed]),
557 [if test "$with_odbc" = no ; then
558 AC_MSG_ERROR([Try running --disable-odbc instead.])
559 elif test "$with_odbc" != yes ; then
560 odbc_dir="$with_odbc/bin"
563 # Try to find the mysql_config program
564 AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
566 if test "$ODBC_CONFIG" = no ; then
567 if test "$odbc_enabled" = "yes" ; then
568 AC_MSG_ERROR(Cannot find odbc_config)
570 AC_MSG_WARN(ODBC not found, skipping.)
575 if test "$build_odbc" = yes ; then
576 ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
577 ODBC_CFLAGS=`eval echo $ODBC_CFLAGS`
578 ODBC_LIBS=`$ODBC_CONFIG --libs`
579 ODBC_LIBS=`eval echo $ODBC_LIBS`
581 save_CPPFLAGS="$CPPFLAGS"
582 CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
584 AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
585 if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
586 AC_MSG_ERROR(unable to find ODBC header files)
589 if test "$have_sql_h" = yes ; then
591 LIBS="$LIBS $ODBC_LIBS"
592 AC_MSG_CHECKING(if we can link againt ODBC)
597 [SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)],
598 [have_odbc_libs=yes],
602 if test "$have_odbc_libs" = no ; then
603 if test "$odbc_enabled" = "yes" ; then
604 AC_MSG_ERROR([unable to link with ODBC Library])
606 AC_MSG_RESULT(no, skipping ODBC)
611 CPPFLAGS="$save_CPPFLAGS"
614 # if have_odbc_libs=yes then go ahead with building ODBC
615 if test "$have_odbc_libs" = yes ; then
616 # this AC_MSG_RESULT is from above!
618 WANT_SUBDIRS="$WANT_SUBDIRS odbc_ccache"
619 AC_SUBST(ODBC_CFLAGS)
624 AC_SUBST(WANT_SUBDIRS)
626 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
627 echo "=================================================================="
628 echo "WARNING: You have chosen to compile Apache-1.3 modules with a different"
629 echo " compiler than the one used to compile Apache."
631 echo " Current compiler: $CC"
632 echo " Apache's compiler: $APXS_CC"
634 echo "This could cause problems."
635 echo "=================================================================="
638 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
639 echo "=================================================================="
640 echo "WARNING: You have chosen to compile Apache-2 modules with a different"
641 echo " compiler than the one used to compile Apache."
643 echo " Current compiler: $CC"
644 echo " Apache's compiler: $APXS2_CC"
646 echo "This could cause problems."
647 echo "=================================================================="
650 LIBTOOL="$LIBTOOL --silent"