Replaced RPC remoting with plain sockets and length-prefixed XML.
[shibboleth/cpp-sp.git] / configure.ac
index 302951a..a2477f3 100644 (file)
@@ -1,10 +1,9 @@
 AC_PREREQ([2.50])
-AC_INIT([shibboleth], [1.3], [shibboleth-users@internet2.edu], [shibboleth])
+AC_INIT([shibboleth], [2.0], [shibboleth-users@internet2.edu], [shibboleth])
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE([shibboleth],[1.3])
+AM_INIT_AUTOMAKE([shibboleth],[2.0])
 
 sinclude(acx_pthread.m4)
-sinclude(acx_rpctest.m4)
 
 AC_ARG_ENABLE(debug,
     AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)
@@ -66,50 +65,6 @@ else
     CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
 fi
 
-# Test RPC now -- finish dealing with it later
-AC_ARG_ENABLE(native-rpc,
-       AC_HELP_STRING([--enable-native-rpc], [use the OS-supplied Sun RPC library, default is NO, except Linux]),
-       [ if test "x$enableval" = "x" ; then
-              NATIVE_RPC=yes
-         else
-             NATIVE_RPC="$enableval"
-         fi
-       ], [ NATIVE_RPC=no ])
-ACX_RPCTEST([rpctest="yes"],[rpctest="no"])
-AC_MSG_NOTICE([does the native Sun RPC library support svcfd_create...$rpctest])
-if test $NATIVE_RPC = "no"; then
-       case "${host}" in
-               *-*-linux*)
-                       if test $rpctest = "yes"; then
-                               AC_MSG_WARN([embedded Sun RPC library does not support Linux])
-                               NATIVE_RPC="yes"
-                       else
-                               AC_MSG_ERROR([embedded Sun RPC library won't work, but neither will native version])
-                       fi
-               ;;
-       esac
-fi
-if test $NATIVE_RPC = "yes" && test $rpctest = "no"; then
-       AC_MSG_WARN([native Sun RPC won't work, using internal version])
-       NATIVE_RPC = "no"
-fi
-if test $NATIVE_RPC = "yes"; then
-       AC_CHECK_DECLS([svcfd_create],,,[#include <rpc/rpc.h>])
-       AC_LANG_PUSH(C++)
-       AC_COMPILE_IFELSE(
-               AC_LANG_PROGRAM(
-                       [[#include <rpc/rpc.h>
-static SVCXPRT* xprt = NULL;]],
-               [[svc_destroy(xprt);]]),
-        AC_DEFINE(HAVE_WORKING_SVC_DESTROY,1,[Define if RPC SVC macros work on this platform]),)
-       AC_LANG_POP(C++)
-else
-       AC_CHECK_TYPES([struct rpcent],,,[#include <netdb.h>])
-       AC_CHECK_DECLS(sys_errlist)
-       AC_DEFINE(HAVE_DECL_SVCFD_CREATE,1,[ Define to 1 if you have the declaration of svcfd_create, and to 0 if you don't.])
-       AC_DEFINE(HAVE_WORKING_SVC_DESTROY,1,[Define if RPC SVC macros work on this platform])
-fi
-
 AC_ARG_WITH(dmalloc,
             AC_HELP_STRING([--with-dmalloc=PATH], [where dmalloc is installed]),
             [if test x_$with_dmalloc != x_/usr; then
@@ -237,19 +192,11 @@ saml::SAMLConfig::getConfig();
         [AC_MSG_ERROR([unable to link with saml, or version too old])])
 
 # output the underlying makefiles
-WANT_SUBDIRS="doc shib schemas configs shib-target shar siterefresh test xmlproviders adfs"
+WANT_SUBDIRS="doc shib schemas configs shib-target shar siterefresh test xmlproviders"
 AC_CONFIG_FILES([Makefile doc/Makefile shib/Makefile schemas/Makefile \
-                configs/Makefile oncrpc/Makefile oncrpc/rpc/Makefile \
-                shib-target/Makefile shar/Makefile siterefresh/Makefile \
-                test/Makefile xmlproviders/Makefile adfs/Makefile selinux/Makefile])
-
+                configs/Makefile shib-target/Makefile shar/Makefile siterefresh/Makefile \
+                test/Makefile xmlproviders/Makefile selinux/Makefile])
 
-# now deal with the rpc library, to see if we need to build our own
-if test $NATIVE_RPC = "no"; then
-    WANT_SUBDIRS="oncrpc $WANT_SUBDIRS"
-       AC_DEFINE(USE_OUR_ONCRPC,1,[Define if using embedded version of ONC RPC.])
-fi
-AM_CONDITIONAL(USE_OUR_ONCRPC,test "$NATIVE_RPC" = "no")
 
 #
 # Build NSAPI module?
@@ -685,6 +632,110 @@ if test "$have_mysql_libs" = yes ; then
 fi
 
 
+#
+# Implement the checks of the ODBC Credential Cache
+#
+# 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.
+#
+
+AC_CONFIG_FILES([odbc_ccache/Makefile])
+
+# determine whether we should enable the odbc ccache
+AC_ARG_ENABLE([odbc],
+       AC_HELP_STRING([--disable-odbc], [disable the ODBC Credential Cache]),
+       [odbc_enabled=$enableval], [odbc_enabled=default])
+
+if test "x$odbc_enabled" = "x" ; then
+   odbc_enabled=yes
+fi
+
+# Are we trying to build ODBC?
+AC_MSG_CHECKING(whether to build the ODBC ccache)
+if test "$odbc_enabled" = "yes" ; then
+   build_odbc=yes
+   AC_MSG_RESULT(yes)
+elif test "$odbc_enabled" = "default" ; then
+   build_odbc=yes
+   AC_MSG_RESULT([yes, if it can be found])
+else
+   build_odbc=no
+   AC_MSG_RESULT(no)
+fi
+
+# If we're trying to build ODBC, try to find the odbc_config program.
+if test "$build_odbc" = "yes" ; then
+   odbc_dir=""
+   AC_ARG_WITH(odbc,
+       AC_HELP_STRING([--with-odbc=PATH], [directory where odbc is installed]),
+           [if test "$with_odbc" = no ; then
+               AC_MSG_ERROR([Try running --disable-odbc instead.])
+             elif test "$with_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
+      if test "$odbc_enabled" = "yes" ; then
+        AC_MSG_ERROR(Cannot find odbc_config)
+      else
+        AC_MSG_WARN(ODBC not found, skipping.)
+      fi
+   fi
+fi
+
+if test "$build_odbc" = yes ; then
+   ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
+   ODBC_CFLAGS=`eval echo $ODBC_CFLAGS`
+   ODBC_LIBS=`$ODBC_CONFIG --libs`
+   ODBC_LIBS=`eval echo $ODBC_LIBS`
+
+   save_CPPFLAGS="$CPPFLAGS"
+   CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
+
+   AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
+   if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
+     AC_MSG_ERROR(unable to find ODBC header files)
+   fi
+
+   if test "$have_sql_h" = yes ; then
+      save_LIBS="$LIBS"
+      LIBS="$LIBS $ODBC_LIBS"
+      AC_MSG_CHECKING(if we can link againt ODBC)
+      AC_TRY_LINK(
+        [#include <sql.h>
+         #include <sqlext.h>
+         #include <stdio.h>],
+        [SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)],
+        [have_odbc_libs=yes],
+        [have_odbc_libs=no])
+      LIBS="$save_LIBS"
+
+      if test "$have_odbc_libs" = no ; then
+         if test "$odbc_enabled" = "yes" ; then
+            AC_MSG_ERROR([unable to link with ODBC Library])
+         else
+            AC_MSG_RESULT(no, skipping ODBC)
+         fi
+      fi
+   fi
+
+   CPPFLAGS="$save_CPPFLAGS"
+fi
+
+# if have_odbc_libs=yes then go ahead with building ODBC
+if test "$have_odbc_libs" = yes ; then
+   # this AC_MSG_RESULT is from above!
+   AC_MSG_RESULT(yes)
+   WANT_SUBDIRS="$WANT_SUBDIRS odbc_ccache"
+   AC_SUBST(ODBC_CFLAGS)
+   AC_SUBST(ODBC_LIBS)
+fi
+
+
 AC_SUBST(WANT_SUBDIRS)
 
 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then