Re: libmariadb compat

Jordi Mallach <[email protected]>
Newsgroups gmane.comp.gnu.mailutils.bugs
Message-ID <[email protected]>
Hi again,

El dt. 18 de 08 de 2026 a les 11:20 +0200, en/na Jordi Mallach va
escriure:
> Hey,
> 
> The attached patch makes configure try -lmysqlclient, and fallback to
> -
> lmariadb if that fails.

Please find the correct patch attached, the other one wasn't sufficient
and I tested with the compat packages installed by accident.

-- 
Jordi Mallach <[email protected]>
mysql-mariadb-fallback.patch (text/x-patch, 2.3 KB)
Author: Jordi Mallach <[email protected]>
Date: Tue, 18 Aug 2026 11:16:41 +0200
Description: Fall back to -lmariadb and mariadb/*.h when using mariadb
 libmariadb-dev ships libmariadb.so and mariadb/{mysql,errmsg}.h
 instead of libmysqlclient.so and mysql/*.h, so --with-mysql needs to
 probe for both layouts.
Forwarded: not-yet, supersedes https://lists.gnu.org/archive/html/bug-mailutils/2026-08/msg00003.html

Index: mailutils/configure.ac
===================================================================
--- mailutils.orig/configure.ac
+++ mailutils/configure.ac
@@ -822,15 +822,24 @@ add_sql_module() {
 AC_SUBST(MYSQLLIBS)
 
 mysql_init() {
-  MU_CHECK_LIB(mysqlclient, 
-	       mysql_real_connect, 
+  MU_CHECK_LIB(mysqlclient,
+	       mysql_real_connect,
 	       [-lm],
                [ AC_DEFINE(USE_SQL)
                  AC_DEFINE(HAVE_MYSQL)
 	         MU_SQL_LDADD(MYSQLLIBS, $mu_cv_lib_mysqlclient)
                  status_mysql=yes ],
-	       [ AC_MSG_FAILURE([The requested library libmysqlclient is not found or is unusable])],
+	       [ MU_CHECK_LIB(mariadb,
+	                mysql_real_connect,
+	                [-lm],
+	                [ AC_DEFINE(USE_SQL)
+	                  AC_DEFINE(HAVE_MYSQL)
+	                  MU_SQL_LDADD(MYSQLLIBS, $mu_cv_lib_mariadb)
+	                  status_mysql=yes ],
+	                [ AC_MSG_FAILURE([The requested library libmysqlclient is not found or is unusable])]) ],
                [/usr/local/lib/mysql /usr/lib/mysql])
+  AC_CHECK_HEADERS([mysql/mysql.h mariadb/mysql.h])
+  AC_CHECK_HEADERS([mysql/errmsg.h mariadb/errmsg.h])
 }
 
 AC_ARG_WITH(mysql,
Index: mailutils/sql/mysql.c
===================================================================
--- mailutils.orig/sql/mysql.c
+++ mailutils/sql/mysql.c
@@ -22,8 +22,20 @@
 #include <mailutils/mailutils.h>
 #include <mailutils/sql.h>
 
-#include <mysql/mysql.h>
-#include <mysql/errmsg.h>
+#if defined(HAVE_MYSQL_MYSQL_H)
+# include <mysql/mysql.h>
+#elif defined(HAVE_MARIADB_MYSQL_H)
+# include <mariadb/mysql.h>
+#else
+# include <mysql/mysql.h>
+#endif
+#if defined(HAVE_MYSQL_ERRMSG_H)
+# include <mysql/errmsg.h>
+#elif defined(HAVE_MARIADB_ERRMSG_H)
+# include <mariadb/errmsg.h>
+#else
+# include <mysql/errmsg.h>
+#endif
 #include <mailutils/sha1.h>
 
 struct mu_mysql_data
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.