Untested ADFS plugin, minus logout.
[shibboleth/cpp-sp.git] / configure.ac
index bb90555..1c2be3d 100644 (file)
@@ -11,30 +11,40 @@ AC_ARG_ENABLE(debug,
     enable_debug=$enableval, enable_debug=no)
 
 if test "$enable_debug" = "yes" ; then
-    GCC_CFLAGS="$CFLAGS -Wall -g -D_DEBUG"
-    GCC_CXXFLAGS="$CXXFLAGS -Wall -g -D_DEBUG"
+    GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
+    GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
 else
-    GCC_CFLAGS="$CFLAGS -Wall -O2 -DNDEBUG"
-    GCC_CXXFLAGS="$CXXFLAGS -Wall -O2 -DNDEBUG"
+    GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
+    GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
 fi
 
 AC_PROG_CC([gcc gcc3 cc])
 AC_PROG_CXX([g++ g++3 c++ CC])
 
 if test "$GCC" = "yes" ; then
-    CFLAGS="$GCC_CFLAGS"
-    CXXFLAGS="$GCC_CXXFLAGS"
+#    AC_HAVE_GCC_VERSION(4,0,0,0,
+#        [
+#        AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
+#            [Define to enable class visibility control in gcc.])
+#        GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
+#        GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
+#        ])
+    CFLAGS="-Wall $GCC_CFLAGS"
+    CXXFLAGS="-Wall $GCC_CXXFLAGS"
+else
+# Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
+       case "${host_cpu}-${host_os}" in
+               *solaris*)
+                       if test "$CXX" = "CC" ; then
+                               CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
+                       fi
+               ;;
+       esac
 fi
 
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 
-AC_LANG(C++)
-
-# C++ requirements
-AC_CXX_REQUIRE_STL
-AC_CXX_NAMESPACES
-
 AC_LANG(C)
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -46,13 +56,6 @@ AC_STRUCT_TM
 AC_FUNC_STRFTIME
 AC_FUNC_STRERROR_R
 AC_CHECK_FUNCS([strchr strdup strstr gmtime_r ctime_r strtok_r strcasecmp])
-AC_CHECK_HEADERS([dlfcn.h])
-
-# old_LIBS="$LIBS"
-# AC_SEARCH_LIBS(xdr_uint64_t,nsl,,
-#      [CFLAGS="$CFLAGS -DNEED_XDR_LONGLONG"
-#       CXXFLAGS="$CXXFLAGS -DNEED_XDR_LONGLONG"])
-# LIBS="$old_LIBS"
 
 # checks for pthreads
 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
@@ -65,50 +68,12 @@ else
     CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
 fi
 
-AC_ARG_WITH(dmalloc,
-            AC_HELP_STRING([--with-dmalloc=PATH], [where dmalloc is installed]),
-            [if test x_$with_dmalloc != x_/usr; then
-                LDFLAGS="-L${with_dmalloc}/lib $LDFLAGS"
-                CPPFLAGS="-I${with_dmalloc}/include $CPPFLAGS"
-            fi
-           AC_CHECK_LIB(dmallocxx, dmalloc_shutdown,,
-                        AC_MSG_ERROR([unable to find dmallocxx library]))
-           ])
-
-# OpenSSL settings
-AC_PATH_PROG(PKG_CONFIG, pkg-config)
-if test "x$PKG_CONFIG" = x || test "x$PKG_CONFIG" = "xno" ; then
-    AC_ARG_WITH(openssl, 
-            AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
-            [if test x_$with_openssl != x_/usr; then
-           SSLLIBS="-L${with_openssl}/lib"
-           SSLFLAGS="-I${with_openssl}/include"
-            fi])
-    SSLLIBS="$SSLLIBS -lssl -lcrypto"
-else
-    SSLLIBS="`$PKG_CONFIG --libs openssl`"
-    SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
-fi
-AC_MSG_CHECKING(for OpenSSL libraries)
-AC_MSG_RESULT($SSLLIBS)
-LIBS="$LIBS $SSLLIBS"
-AC_MSG_CHECKING(for OpenSSL cflags)
-AC_MSG_RESULT($SSLFLAGS)
-CPPFLAGS="$SSLFLAGS $CPPFLAGS"
-
-AC_CHECK_HEADER([openssl/ssl.h],,
-                AC_MSG_ERROR([unable to find openssl header files]))
-AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
-AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
-             AC_MSG_ERROR([unable to link with openssl libraries]))
-AC_MSG_RESULT(yes)
-AC_MSG_CHECKING(for SSL_library_init)
-AC_TRY_LINK_FUNC([SSL_library_init],, 
-             AC_MSG_ERROR([unable to link with openssl libraries]))
-AC_MSG_RESULT(yes)
-
 AC_LANG(C++)
 
+# C++ requirements
+AC_CXX_REQUIRE_STL
+AC_CXX_NAMESPACES
+
 # log4cpp settings
 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
 AC_ARG_WITH(log4cpp,
@@ -140,14 +105,14 @@ AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,
                 AC_MSG_ERROR([unable to find xerces header files]))
 AC_MSG_CHECKING([Xerces version])
 AC_PREPROC_IFELSE(
-        [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
-[#if  _XERCES_VERSION > 20200 && _XERCES_VERSION != 20600
+    [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
+[#if  _XERCES_VERSION != 20600
 int i = 0;
 #else
-#error requires version > 2.2.0 but not 2.6.0
+#error cannot use version 2.6.0
 #endif])],
-        [AC_MSG_RESULT(OK)],
-        [AC_MSG_ERROR([Shibboleth requires patched Xerces version 2.6.1 (http://shibboleth.internet2.edu/downloads/)])])
+    [AC_MSG_RESULT(OK)],
+    [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
 AC_TRY_LINK(
         [#include <xercesc/util/PlatformUtils.hpp>],
         [xercesc::XMLPlatformUtils::Initialize()],
@@ -155,33 +120,70 @@ AC_TRY_LINK(
         [AC_MSG_ERROR([unable to link with Xerces])])
 
 
+#XML-Tooling settings
+AC_ARG_WITH(xmltooling,
+            AC_HELP_STRING([--with-xmltooling=PATH], [where xmltooling-c is installed]),
+            [if test x_$with_xmltooling != x_/usr; then
+                LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
+                CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
+            fi])
+LITE_LIBS="-lxmltooling-lite"
+XMLSEC_LIBS="-lxmltooling"
+AC_CHECK_HEADER([xmltooling/base.h],,
+                AC_MSG_ERROR([unable to find xmltooling header files]))
+
+
 # XML-Security settings
 AC_ARG_WITH(xmlsec,
-            AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
-            [if test x_$with_xmlsec != x_/usr; then
-                LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
-                CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
-            fi])
-LIBS="-lxml-security-c $LIBS"
-AC_CHECK_HEADER([xsec/xenc/XENCEncryptionMethod.hpp],,AC_MSG_ERROR([unable to find xml-security 1.1 header files]),[#include <xercesc/dom/DOM.hpp>])
+            AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
+            [with_xmlsec=/usr])
+
+if test x_$with_xmlsec != x_/usr; then
+    LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
+    CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
+fi        
+XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
+
+# save and append master libs
+save_LIBS="$LIBS"
+LIBS="$XMLSEC_LIBS $LIBS"
+
+AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
+AC_MSG_CHECKING([XML-Security version])
+AC_PREPROC_IFELSE(
+    [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
+    [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3) || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM == 3 && XSEC_VERSION_MINOR > 0)
+int i = 0;
+#else
+#error need version 1.3.1 or later
+#endif])],
+    [AC_MSG_RESULT(OK)],
+    [AC_MSG_FAILURE([XML-Security version 1.3.1 or greater is required.])])
 AC_TRY_LINK(
         [#include <xsec/utils/XSECPlatformUtils.hpp>],
-        [XSECPlatformUtils::Initialise()],
-        [AC_DEFINE(HAVE_LIBXSEC,1,[Define if XML-Sec library was found])],
-        [AC_MSG_ERROR([unable to link with xml-security])])
+        [XSECPlatformUtils::Initialise()],,
+        [AC_MSG_ERROR([unable to link with XML-Sec])])
+
+# restore master libs
+LIBS="$save_LIBS"
 
 # OpenSAML settings
 AC_ARG_WITH(saml,
-            AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
-            [if test x_$with_saml != x_/usr; then
-                LDFLAGS="-L${with_saml}/lib $LDFLAGS"
-                CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
-            fi])
-AC_CHECK_HEADER([saml/saml.h],,
-                AC_MSG_ERROR([unable to find saml header files]))
-LIBS="-lsaml $LIBS"
+    AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
+    [if test x_$with_saml != x_/usr; then
+        LDFLAGS="-L${with_saml}/lib $LDFLAGS"
+        CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
+    fi])
+XMLSEC_LIBS="-lsaml $XMLSEC_LIBS"
+
+# save and append master libs
+save_LIBS="$LIBS"
+LIBS="$XMLSEC_LIBS $LIBS"
+
+AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],,
+                AC_MSG_ERROR([unable to find OpenSAML header files]))
 AC_TRY_LINK(
-       [#include <saml/saml.h>
+       [#include <saml/SAMLConfig.h>
 #include <saml/version.h>],
        [#if _OPENSAML_VERSION >= 20000
 opensaml::SAMLConfig::getConfig();
@@ -189,14 +191,19 @@ opensaml::SAMLConfig::getConfig();
 #error Need OpenSAML version 2.0 or higher
 #endif],
         [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])],
-        [AC_MSG_ERROR([unable to link with saml, or version too old])])
+        [AC_MSG_ERROR([unable to link with OpenSAML, or version was too old])])
+
+# restore master libs
+LIBS="$save_LIBS"
+
+AC_SUBST(LITE_LIBS)
+AC_SUBST(XMLSEC_LIBS)
 
 # output the underlying makefiles
-WANT_SUBDIRS="doc schemas configs shibsp shibd siterefresh test"
+WANT_SUBDIRS="doc schemas configs shibsp shibd adfs util"
 AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
-                configs/Makefile shibsp/Makefile shibd/Makefile siterefresh/Makefile \
-                test/Makefile selinux/Makefile])
-
+       configs/Makefile shibsp/Makefile shibd/Makefile \
+       adfs/Makefile util/Makefile selinux/Makefile])
 
 #
 # Build NSAPI module?
@@ -241,6 +248,61 @@ if test ! "$WANT_NSAPI" = "no" ; then
     WANT_SUBDIRS="$WANT_SUBDIRS nsapi_shib"
 fi
 
+#
+# If no --enable-apache-xx specified 
+# find a default and fake the specific parameters
+#
+
+# simple macro to peek at an enable or a with
+AC_DEFUN([Peek],
+if test "[${[$1]_][$2]+set}" = set; then
+  peekval="${[$1]_[$2]}"
+  $3
+fi; dnl
+)
+
+AC_MSG_CHECKING(if default apache needed)
+need_default=yes
+Peek(enable,apache_13,need_default=no)
+Peek(enable,apache_20,need_default=no)
+Peek(enable,apache_22,need_default=no)
+AC_MSG_RESULT($need_default)
+
+if test "$need_default" = "yes"; then
+  # find an apxs, then the httpd
+  xs=
+  Peek(with,apxs,xs="$peekval")
+  Peek(with,apxs2,xs="$peekval")
+  Peek(with,apxs22,xs="$peekval")
+  if test "x$xs" = "x"; then
+     AC_PATH_PROGS(xs, apxs2 apxs,
+        AC_MSG_ERROR(No apxs, no apache found.  Try --with-apxs),
+        [/usr/local/apache2/bin:/usr/local/apache/bin:/usr/sbin:$PATH])
+  fi
+  # ask the daemon for the version and set parameters
+  AC_MSG_CHECKING(default apache version)
+  httpd="`$xs -q SBINDIR`/`$xs -q TARGET`"
+  if test "x$httpd" != "x"; then
+     v=`$httpd -v|$SED -n -e 's/.*Apache\/\.*//p'`
+     case $v in
+       1.3*)   [enable_apache_13]=yes
+               [with_apxs]=$xs
+               AC_MSG_RESULT(1.3)
+               ;;
+       2.0*)   [enable_apache_20]=yes
+               [with_apxs2]=$xs
+               AC_MSG_RESULT(2.0)
+               ;;
+       2.2*)   [enable_apache_22]=yes
+               [with_apxs22]=$xs
+               AC_MSG_RESULT(2.2)
+               ;;
+       *)      AC_MSG_ERROR(unusable apache versions: $v. Try setting --with-apxs)
+     esac
+  else 
+     AC_MSG_RESULT(cannot determine version.  Try setting --with-apxs)
+  fi
+fi
 
 # Apache 1.3 (mod_shib_13)
 #   --enable-apache-13
@@ -495,18 +557,18 @@ fi
 
 
 #
-# Implement the checks of the ODBC Credential Cache
+# Implement the checks of the ODBC Storage Service
 #
 # 1) Assume the user wants ODBC; if it's not found then just continue without
 # 2) If the user specifically requested odbc, look for it and ERROR if not found
-# 3) If the user specifically requested no-odbc, don't build it.
+# 3) If the user specifically requested no odbc, don't build it.
 #
 
-AC_CONFIG_FILES([odbc_ccache/Makefile])
+AC_CONFIG_FILES([odbc-store/Makefile])
 
 # determine whether we should enable the odbc ccache
 AC_ARG_ENABLE([odbc],
-       AC_HELP_STRING([--disable-odbc], [disable the ODBC Credential Cache]),
+       AC_HELP_STRING([--disable-odbc], [disable the ODBC Storage Service]),
        [odbc_enabled=$enableval], [odbc_enabled=default])
 
 if test "x$odbc_enabled" = "x" ; then
@@ -514,7 +576,7 @@ if test "x$odbc_enabled" = "x" ; then
 fi
 
 # Are we trying to build ODBC?
-AC_MSG_CHECKING(whether to build the ODBC ccache)
+AC_MSG_CHECKING(whether to build the ODBC storage service)
 if test "$odbc_enabled" = "yes" ; then
    build_odbc=yes
    AC_MSG_RESULT(yes)
@@ -537,7 +599,6 @@ if test "$build_odbc" = "yes" ; then
                odbc_dir="$with_odbc/bin"
              fi ])
 
-   # Try to find the mysql_config program
    AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
 
    if test "$ODBC_CONFIG" = no ; then
@@ -592,7 +653,7 @@ fi
 if test "$have_odbc_libs" = yes ; then
    # this AC_MSG_RESULT is from above!
    AC_MSG_RESULT(yes)
-   WANT_SUBDIRS="$WANT_SUBDIRS odbc_ccache"
+   WANT_SUBDIRS="$WANT_SUBDIRS odbc-store"
    AC_SUBST(ODBC_CFLAGS)
    AC_SUBST(ODBC_LIBS)
 fi
@@ -614,7 +675,7 @@ fi
 
 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
   echo "=================================================================="
-  echo "WARNING: You have chosen to compile Apache-2 modules with a different"
+  echo "WARNING: You have chosen to compile Apache-2.0 modules with a different"
   echo "         compiler than the one used to compile Apache."
   echo ""
   echo "    Current compiler:      $CC"
@@ -624,6 +685,18 @@ if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
   echo "=================================================================="
 fi
 
+if test -n "$APXS22_CC" && test "$APXS22_CC" != "$CC" ; then
+  echo "=================================================================="
+  echo "WARNING: You have chosen to compile Apache-2.2 modules with a different"
+  echo "         compiler than the one used to compile Apache."
+  echo ""
+  echo "    Current compiler:      $CC"
+  echo "   Apache's compiler:      $APXS22_CC"
+  echo ""
+  echo "This could cause problems."
+  echo "=================================================================="
+fi
+
 LIBTOOL="$LIBTOOL --silent"
 
 AC_OUTPUT