aboutsummaryrefslogtreecommitdiff
path: root/m4/libodbc.m4
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-01-17 16:40:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-17 16:40:19 +0200
commit16054e2d129d7c5e956be7b33c29ae6c2ea5c962 (patch)
tree8d8f22207d3b763eb978f700e68ad74d657aa4c5 /m4/libodbc.m4
parentc853481c254bcafeeca394faa9f4bb5205d4daa0 (diff)
Autotools and VC++ build support
Diffstat (limited to 'm4/libodbc.m4')
-rw-r--r--m4/libodbc.m472
1 files changed, 72 insertions, 0 deletions
diff --git a/m4/libodbc.m4 b/m4/libodbc.m4
new file mode 100644
index 0000000..f8f1bb1
--- /dev/null
+++ b/m4/libodbc.m4
@@ -0,0 +1,72 @@
+dnl file : m4/libodbc.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+dnl LIBODBC([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
+dnl
+AC_DEFUN([LIBODBC], [
+libodbc_found=no
+
+AC_MSG_CHECKING([for libodbc])
+
+save_LIBS="$LIBS"
+
+case $host_os in
+ mingw*)
+ LIBS="-lodbc32 $LIBS"
+ ;;
+ *)
+ LIBS="-lodbc $LIBS"
+ ;;
+esac
+
+CXX_LIBTOOL_LINK_IFELSE(
+AC_LANG_SOURCE([[
+#ifdef _WIN32
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+#endif
+
+#include <sqlext.h>
+
+int
+main ()
+{
+ SQLHENV env;
+ SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+ SQLHDBC conn;
+ SQLAllocHandle (SQL_HANDLE_DBC, env, &conn);
+ SQLDriverConnectA (conn,
+ 0,
+ (SQLCHAR*) "example.com",
+ SQL_NTS,
+ 0,
+ 0,
+ 0,
+ SQL_DRIVER_NOPROMPT);
+
+ SQLHSTMT stmt;
+ SQLAllocHandle (SQL_HANDLE_STMT, conn, &stmt);
+ SQLPrepareA (stmt, (SQLCHAR*) "SELECT 1", SQL_NTS);
+}
+]]),
+[
+libodbc_found=yes
+])
+
+if test x"$libodbc_found" = xno; then
+ LIBS="$save_LIBS"
+fi
+
+if test x"$libodbc_found" = xyes; then
+ AC_MSG_RESULT([yes])
+ $1
+else
+ AC_MSG_RESULT([no])
+ $2
+fi
+])dnl