From 9482d6b34cbd4b8f1fc1d00e77e597309d873795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 8 Sep 2019 19:26:24 +0200 Subject: [PATCH] Added detection whether the basic structure of MySQL / MariaDB client is named st_mysql or MYSQL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This resolves FTBFS with MySQL client >= 8.0. This resolves issue #9. Signed-off-by: Slávek Banko (cherry picked from commit 7b0045aa6b827715b1e8e4efc28278ebdabb55f5) --- amarok/configure.in.in | 35 +++++++++++++++++++++++++++++++++++ amarok/src/collectiondb.h | 2 +- config.h.in | 3 +++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/amarok/configure.in.in b/amarok/configure.in.in index a53a17f1..849a2614 100644 --- a/amarok/configure.in.in +++ b/amarok/configure.in.in @@ -496,6 +496,40 @@ if test "$enable_mysql" = "yes"; then mysql_includes=`mysql_config --cflags` mysql_libs=`mysql_config --libs` + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $mysql_includes" + + AC_MSG_CHECKING([if mysql has st_mysql struct]) + AC_TRY_COMPILE( + [ + #include + typedef struct st_mysql MYSQL; + ], + [], + AC_MSG_RESULT( yes ) + mysql_struct=st_mysql, + AC_MSG_RESULT( no ) + [ + AC_MSG_CHECKING([if mysql has MYSQL struct]) + AC_TRY_COMPILE( + [ + #include + typedef struct MYSQL MYSQL; + ], + [], + AC_MSG_RESULT( yes ) + mysql_struct=MYSQL, + AC_MSG_RESULT( no ) + enable_mysql=no + ) + ] + ) + + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE else amarok_warning_mysql_notfound=yes enable_mysql=no @@ -504,6 +538,7 @@ if test "$enable_mysql" = "yes"; then fi AM_CONDITIONAL(enable_mysql, test x$enable_mysql = xyes) +AC_DEFINE_UNQUOTED(MYSQL_STRUCT, $mysql_struct, [struct type name for MySql]) AC_SUBST(mysql_includes) AC_SUBST(mysql_libs) diff --git a/amarok/src/collectiondb.h b/amarok/src/collectiondb.h index b9a42d53..16ab29a6 100644 --- a/amarok/src/collectiondb.h +++ b/amarok/src/collectiondb.h @@ -149,7 +149,7 @@ class SqliteConnection : public DbConnection #ifdef USE_MYSQL -typedef struct st_mysql MYSQL; +typedef struct MYSQL_STRUCT MYSQL; class MySqlConnection : public DbConnection { diff --git a/config.h.in b/config.h.in index 34a6a06f..7886e643 100644 --- a/config.h.in +++ b/config.h.in @@ -230,6 +230,9 @@ */ #undef LT_OBJDIR +/* struct type name for MySql */ +#undef MYSQL_STRUCT + /* Name of package */ #undef PACKAGE