From ef559d3c3881dafd527b43ac3fc6e771091d6198 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Fri, 21 Dec 2018 16:59:47 +0100 Subject: [PATCH] [354-compilation-with-mysql-fails-on-fedora-29] Added HAVE_MYSQL_MY_BOOL --- configure.ac | 28 +++++++++++++++++++--------- src/lib/mysql/mysql_constants.h | 12 ++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index a986e8ba1d..01dbb61d5b 100644 --- a/configure.ac +++ b/configure.ac @@ -727,20 +727,30 @@ if test "$MYSQL_CONFIG" != "" ; then LIBS="$MYSQL_LIBS $LIBS" AC_LINK_IFELSE( - [AC_LANG_PROGRAM([#include ], - [MYSQL mysql_handle; - (void) mysql_init(&mysql_handle); - ])], - [AC_MSG_RESULT([checking for MySQL headers and library... yes])], - [AC_MSG_RESULT([checking for MySQL headers and library... no]) - AC_MSG_ERROR([Needs MySQL library])] + [AC_LANG_PROGRAM([#include ], + [MYSQL mysql_handle; + (void) mysql_init(&mysql_handle); + ])], + [AC_MSG_RESULT([checking for MySQL headers and library... yes])], + [AC_MSG_RESULT([checking for MySQL headers and library... no]) + AC_MSG_ERROR([Needs MySQL library])] ) + # Note that MYSQL is present in the config.h file + AC_DEFINE([HAVE_MYSQL], [1], [MySQL is present]) + + # Check is my_bool is defined. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include + const my_bool MLM_FALSE = 0;] + [])], + [AC_MSG_RESULT([checking for MySQL my_bool... yes]) + AC_DEFINE([HAVE_MYSQL_MY_BOOL], [1], [MySQL uses my_bool])], + [AC_MSG_RESULT([checking for MySQL my_bool... no])]) + CPPFLAGS=$CPPFLAGS_SAVED LIBS=$LIBS_SAVED - # Note that MYSQL is present in the config.h file - AC_DEFINE([HAVE_MYSQL], [1], [MySQL is present]) fi # Solaris puts FIONREAD in filio.h diff --git a/src/lib/mysql/mysql_constants.h b/src/lib/mysql/mysql_constants.h index ee1a8937e6..64b052017c 100644 --- a/src/lib/mysql/mysql_constants.h +++ b/src/lib/mysql/mysql_constants.h @@ -16,12 +16,24 @@ namespace db { /// //@{ +#ifdef HAVE_MYSQL_MY_BOOL /// @brief MySQL false value. const my_bool MLM_FALSE = 0; /// @brief MySQL true value. const my_bool MLM_TRUE = 1; +#else +/// @brief my_bool type for MySQL 8.x. +typedef bool my_bool; + +/// @brief MySQL false value. +const my_bool MLM_FALSE = false; + +/// @brief MySQL true value. +const my_bool MLM_TRUE = true; +#endif + /// @brief MySQL fetch success code. const int MLM_MYSQL_FETCH_SUCCESS = 0; -- 2.47.2