aboutsummaryrefslogtreecommitdiff
path: root/m4/libmysqlclient.m4
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-30 15:51:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-30 15:51:23 +0200
commit1692b3e82521e7d73a908f532eced90491e1eded (patch)
treec45272faba67485f3702395f43282a81a981cf5f /m4/libmysqlclient.m4
parent4452be925b749572f0e3edcb21e9af818647eb55 (diff)
Support for automake and VC++ builds
Diffstat (limited to 'm4/libmysqlclient.m4')
-rw-r--r--m4/libmysqlclient.m453
1 files changed, 53 insertions, 0 deletions
diff --git a/m4/libmysqlclient.m4 b/m4/libmysqlclient.m4
new file mode 100644
index 0000000..3f607a2
--- /dev/null
+++ b/m4/libmysqlclient.m4
@@ -0,0 +1,53 @@
+dnl file : m4/libmysqlclient.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+dnl LIBMYSQLCLIENT(MULTI-THREADED=none|<other>,
+dnl [ACTION-IF-FOUND[,
+dnl ACTION-IF-NOT-FOUND]])
+dnl
+dnl
+AC_DEFUN([LIBMYSQLCLIENT], [
+libmysqlclient_found=no
+
+if test x"$1" != xnone; then
+ libmysqlclient_name=mysqlclient_r
+else
+ libmysqlclient_name=mysqlclient
+fi
+
+AC_MSG_CHECKING([for lib$libmysqlclient_name])
+
+save_LIBS="$LIBS"
+LIBS="-l$libmysqlclient_name $LIBS"
+
+CXX_LIBTOOL_LINK_IFELSE(
+AC_LANG_SOURCE([[
+#include <mysql/mysql.h>
+
+int
+main ()
+{
+ MYSQL handle;
+ mysql_init (&handle);
+ mysql_real_connect (&handle, 0, 0, 0, 0, 0, 0, 0);
+ MYSQL_STMT* stmt = mysql_stmt_init (&handle);
+ mysql_stmt_close (stmt);
+ mysql_close (&handle);
+}
+]]),
+[libmysqlclient_found=yes])
+
+if test x"$libmysqlclient_found" = xno; then
+ LIBS="$save_LIBS"
+fi
+
+if test x"$libmysqlclient_found" = xyes; then
+ AC_MSG_RESULT([yes])
+ $2
+else
+ AC_MSG_RESULT([no])
+ $3
+fi
+])dnl