Blame SOURCES/apr-util-mariadb-upstream.patch

5e0cd6
Upstream patch for building with mariadb:
5e0cd6
Taken from https://bz.apache.org/bugzilla/show_bug.cgi?id=61517
5e0cd6
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1494093
5e0cd6
5e0cd6
--- a/build/dbd.m4	2017-05-03 19:18:52.000000000 -0400
5e0cd6
+++ a/build/dbd.m4	2017-09-13 16:58:07.369546391 -0400
5e0cd6
@@ -163,10 +163,15 @@ 
5e0cd6
   old_cppflags="$CPPFLAGS"
5e0cd6
   old_ldflags="$LDFLAGS"
5e0cd6
 
5e0cd6
+  my_library="mysqlclient"
5e0cd6
+
5e0cd6
   AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]),
5e0cd6
   [
5e0cd6
     if test "$withval" = "yes"; then
5e0cd6
       AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
5e0cd6
+      if test "x$MYSQL_CONFIG" = "x"; then
5e0cd6
+        AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config])
5e0cd6
+      fi
5e0cd6
       if test "x$MYSQL_CONFIG" != 'x'; then
5e0cd6
         mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
5e0cd6
         mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
5e0cd6
@@ -174,32 +179,40 @@ 
5e0cd6
 
5e0cd6
         APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
5e0cd6
         APR_ADDTO(LIBS, [$mysql_LIBS])
5e0cd6
+
5e0cd6
+	if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
5e0cd6
+	  my_library="mariadb"
5e0cd6
+	fi
5e0cd6
       fi
5e0cd6
 
5e0cd6
-      AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h],
5e0cd6
-                       AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
5e0cd6
-                       [apu_have_mysql=0; break],
5e0cd6
-                       [#include <my_global.h>])
5e0cd6
-      if test "$apu_have_mysql" = "0"; then
5e0cd6
-        AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h],
5e0cd6
-                         AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
5e0cd6
-                         [apu_have_mysql=0; break],
5e0cd6
-                         [#include <mysql/my_global.h>])
5e0cd6
+      AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
5e0cd6
+      if test "$apr_have_mysql" = "0"; then
5e0cd6
+	AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
5e0cd6
       fi
5e0cd6
-      if test "$apu_have_mysql" != "0" && test "x$MYSQL_CONFIG" != 'x'; then
5e0cd6
-        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
5e0cd6
+      if test "$apr_have_mysql" = "1"; then
5e0cd6
+	AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
5e0cd6
+	AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
5e0cd6
+      fi
5e0cd6
+      if test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then
5e0cd6
+	APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
5e0cd6
       fi
5e0cd6
     elif test "$withval" = "no"; then
5e0cd6
       :
5e0cd6
     else
5e0cd6
       AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
5e0cd6
+      if test "x$MYSQL_CONFIG" = "x"; then
5e0cd6
+	AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config],,[$withval/bin])
5e0cd6
+      fi
5e0cd6
       if test "x$MYSQL_CONFIG" != 'x'; then
5e0cd6
-        mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
5e0cd6
-        mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
5e0cd6
-        mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
5e0cd6
+	mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
5e0cd6
+	mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
5e0cd6
+	mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
5e0cd6
+	if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
5e0cd6
+	  my_library="mariadb"
5e0cd6
+	fi
5e0cd6
       else
5e0cd6
-        mysql_CPPFLAGS="-I$withval/include"
5e0cd6
-        mysql_LDFLAGS="-L$withval/lib "
5e0cd6
+	mysql_CPPFLAGS="-I$withval/include"
5e0cd6
+	mysql_LDFLAGS="-L$withval/lib "
5e0cd6
       fi
5e0cd6
 
5e0cd6
       APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
5e0cd6
@@ -207,18 +220,15 @@ 
5e0cd6
       APR_ADDTO(LIBS, [$mysql_LIBS])
5e0cd6
 
5e0cd6
       AC_MSG_NOTICE(checking for mysql in $withval)
5e0cd6
-      AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h],
5e0cd6
-                       AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
5e0cd6
-                       [apu_have_mysql=0; break],
5e0cd6
-                       [#include <my_global.h>])
5e0cd6
-
5e0cd6
-      if test "$apu_have_mysql" != "1"; then
5e0cd6
-        AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h],
5e0cd6
-                         AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
5e0cd6
-                         [apu_have_mysql=0; break],
5e0cd6
-                         [#include <mysql/my_global.h>])
5e0cd6
+      AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
5e0cd6
+      if test "$apr_have_mysql" = "0"; then
5e0cd6
+	AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
5e0cd6
+      fi
5e0cd6
+      if test "$apr_have_mysql" = "1"; then
5e0cd6
+	AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
5e0cd6
+	AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
5e0cd6
       fi
5e0cd6
-      if test "$apu_have_mysql" != "0"; then
5e0cd6
+      if test "$apu_have_mysql" = "1"; then
5e0cd6
         APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
5e0cd6
       fi
5e0cd6
     fi
5e0cd6
@@ -229,7 +239,7 @@ 
5e0cd6
   dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
5e0cd6
   dnl we know the library is there.
5e0cd6
   if test "$apu_have_mysql" = "1"; then
5e0cd6
-    APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -lmysqlclient $mysql_LIBS])
5e0cd6
+    APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -l$my_library $mysql_LIBS])
5e0cd6
   fi
5e0cd6
   AC_SUBST(LDADD_dbd_mysql)
5e0cd6
 
5e0cd6
--- a/dbd/apr_dbd_mysql.c	2017-05-03 19:18:52.000000000 -0400
5e0cd6
+++ a/dbd/apr_dbd_mysql.c	2017-09-13 19:15:20.894368809 -0400
5e0cd6
@@ -1262,7 +1262,9 @@ 
5e0cd6
 
5e0cd6
 static void dbd_mysql_init(apr_pool_t *pool)
5e0cd6
 {
5e0cd6
+#if MYSQL_VERSION_ID < 100000
5e0cd6
     my_init();
5e0cd6
+#endif
5e0cd6
     mysql_thread_init();
5e0cd6
 
5e0cd6
     /* FIXME: this is a guess; find out what it really does */
5e0cd6