-#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 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"
+ if test "$with_odbc" != /usr ; then
+ ODBC_CFLAGS="-I$with_odbc/include"
+ ODBC_LIBS="-L$with_odbc/lib"
+ fi
+ fi ])
+
+ AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
+ if test "$ODBC_CONFIG" = no ; then
+ AC_MSG_WARN([Cannot find odbc_config, will try to guess settings.])
+ ODBC_LIBS="$ODBC_LIBS -lodbc"
+ else
+ ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
+ ODBC_LIBS=`$ODBC_CONFIG --libs`
+ fi
+
+ 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