summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-11 11:35:06 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-11 11:35:25 +0200
commit286759692f1d5c84da625d5c0ced374a2585e978 (patch)
tree997953d000fbda96123811b8faa63ee428539edf
parentc0349b05c9736151899fa7aae3231cc64fca2bc4 (diff)
fix: mysql version detection
Fix detection macro and support mysql8+ my_bool deprecation. Fixes #6465.
-rw-r--r--configure.ac18
-rw-r--r--src/mysql/mysql.c8
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);