From 7e36703d12fe5f0b33960bb0fdbe03f9a08323be Mon Sep 17 00:00:00 2001
From: Roland Fehrenbacher <rf@q-leap.de>
Date: Fri, 18 Nov 2016 14:08:57 -0700
Subject: [PATCH] [PATCH] QL - x_ac_databases.m4: Make mariadb_config an
 alternative to mysql_config

On some distributions (notably Ubuntu xenial), the mariadb client
dev package doesn't include a compatibility link for mysql_config.
This patch makes configure look for mariadb_config as an alternative
and allows building the mysql plugins against mariadb client libs.
---
 auxdir/x_ac_databases.m4 |  4 ++--
 configure                | 22 ++++++++++++++++------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/auxdir/x_ac_databases.m4 b/auxdir/x_ac_databases.m4
index a0ede7ece32..6f78741a0ec 100644
--- a/auxdir/x_ac_databases.m4
+++ b/auxdir/x_ac_databases.m4
@@ -22,9 +22,9 @@ AC_DEFUN([X_AC_DATABASES],
 		[_x_ac_mysql_bin="$withval"])
 
 	if test x$_x_ac_mysql_bin = xno; then
-    		AC_PATH_PROG(HAVEMYSQLCONFIG, mysql_config, no)
+		AC_PATH_PROGS(HAVEMYSQLCONFIG, [mysql_config mariadb_config], no)
 	else
-   		AC_PATH_PROG(HAVEMYSQLCONFIG, mysql_config, no, $_x_ac_mysql_bin)
+		AC_PATH_PROGS(HAVEMYSQLCONFIG, [mysql_config mariadb_config], no, $_x_ac_mysql_bin)
 	fi
 
 	if test x$HAVEMYSQLCONFIG = xno; then
diff --git a/configure b/configure
index 5474f8c79a3..0b635a8a95a 100755
--- a/configure
+++ b/configure
@@ -21788,8 +21788,10 @@ fi
 
 
 	if test x$_x_ac_mysql_bin = xno; then
-    		# Extract the first word of "mysql_config", so it can be a program name with args.
-set dummy mysql_config; ac_word=$2
+		for ac_prog in mysql_config mariadb_config
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_path_HAVEMYSQLCONFIG+:} false; then :
@@ -21815,7 +21817,6 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_HAVEMYSQLCONFIG" && ac_cv_path_HAVEMYSQLCONFIG="no"
   ;;
 esac
 fi
@@ -21829,9 +21830,15 @@ $as_echo "no" >&6; }
 fi
 
 
+  test -n "$HAVEMYSQLCONFIG" && break
+done
+test -n "$HAVEMYSQLCONFIG" || HAVEMYSQLCONFIG="no"
+
 	else
-   		# Extract the first word of "mysql_config", so it can be a program name with args.
-set dummy mysql_config; ac_word=$2
+		for ac_prog in mysql_config mariadb_config
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_path_HAVEMYSQLCONFIG+:} false; then :
@@ -21857,7 +21864,6 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_HAVEMYSQLCONFIG" && ac_cv_path_HAVEMYSQLCONFIG="no"
   ;;
 esac
 fi
@@ -21871,6 +21877,10 @@ $as_echo "no" >&6; }
 fi
 
 
+  test -n "$HAVEMYSQLCONFIG" && break
+done
+test -n "$HAVEMYSQLCONFIG" || HAVEMYSQLCONFIG="no"
+
 	fi
 
 	if test x$HAVEMYSQLCONFIG = xno; then
-- 
GitLab