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

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