From: cantor Date: Fri, 27 Jan 2006 04:21:28 +0000 (+0000) Subject: Added ODBC to build. X-Git-Tag: 2.4~1120 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=ce5d71d7442610d55fe0fe9d2651fc9eb1052571;hp=35746ee8625c8b2fae38bf0b43a3ee917d618cb4;p=shibboleth%2Fsp.git Added ODBC to build. git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@1964 cb58f699-b61c-0410-a6fe-9272a202ed29 --- diff --git a/configure.ac b/configure.ac index b71c0b2..27cff46 100644 --- a/configure.ac +++ b/configure.ac @@ -739,6 +739,125 @@ 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 we found odbc_config then build_odbc is 'yes' +if test "$ODBC_CONFIG" != no ; then + AC_MSG_CHECKING(for ODBC libraries) + ODBC_LIBS=`$ODBC_CONFIG --libs` + if test $? != 0 ; then + found_odbc=no + if test "$odbc_enabled" = "yes" ; then + AC_MSG_ERROR(Could not find the ODBC libraries.) + else + AC_MSG_RESULT(no.. skipping ODBC) + fi + else + found_odbc=yes + AC_MSG_RESULT(yes) + fi +fi + +if test "$found_odbc" = yes ; then + ODBC_CFLAGS=`$ODBC_CONFIG --cflags` + ODBC_CFLAGS=`eval echo $ODBC_CFLAGS` + 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 + #include ], + [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