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

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