[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/02: fix: mysql version detection
From: |
gnunet |
Subject: |
[gnunet] 02/02: fix: mysql version detection |
Date: |
Tue, 11 Aug 2020 11:42:44 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 286759692f1d5c84da625d5c0ced374a2585e978
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Tue Aug 11 11:35:06 2020 +0200
fix: mysql version detection
Fix detection macro and support mysql8+ my_bool deprecation. Fixes #6465.
---
configure.ac | 18 ++++++++++++++++--
src/mysql/mysql.c | 8 +++++++-
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 39e7ffa7e..88a2134ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1404,12 +1404,11 @@ AS_IF([test "$mysql" = "true" -a
"x$enable_mysql_version_check" = "xyes"],
AC_MSG_CHECKING(mysql version)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
- #include <mysql/mysql.h>]],
+ #include <mysql/mysql_version.h>]],
[[
#if (MYSQL_VERSION_ID < 40100)
#error needs at least version >= 4.1
#endif
- int main () { return 0; }
]])
],
[mysql=true],
@@ -1423,6 +1422,21 @@ AS_IF([test "$mysql" = "true" -a
"x$enable_mysql_version_check" = "xyes"],
mysqlfail=false
AC_MSG_RESULT(ok)
])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <mysql/mysql_version.h>]],
+ [[
+ #if (MYSQL_VERSION_ID < 80000)
+ #error needs at least version >= 4.1
+ #endif
+ ]])
+ ],
+ [mysql8=true],
+ [mysql8=false])
+ AS_IF([test x$mysql8 = xtrue],
+ [
+ AC_DEFINE([HAVE_MYSQL8],[1],[Have mysql8])
+ ],[])
])
AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
diff --git a/src/mysql/mysql.c b/src/mysql/mysql.c
index 713227068..4df1893c6 100644
--- a/src/mysql/mysql.c
+++ b/src/mysql/mysql.c
@@ -26,6 +26,12 @@
#include <mysql/mysql.h>
#include "gnunet_mysql_lib.h"
+#ifdef HAVE_MYSQL8
+ typedef bool MYSQL_BOOL;
+#else
+ typedef my_bool MYSQL_BOOL; //MySQL < 8 wants this
+#endif
+
/**
* Maximum number of supported parameters for a prepared
* statement. Increase if needed.
@@ -220,7 +226,7 @@ iopen (struct GNUNET_MYSQL_Context *mc)
char *mysql_user;
char *mysql_password;
unsigned long long mysql_port;
- my_bool reconnect;
+ MYSQL_BOOL reconnect;
unsigned int timeout;
mc->dbf = mysql_init (NULL);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.