Skip to content

Commit

Permalink
Allow mariadbclient to be used for check_mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
tonvoon authored and sni committed Aug 12, 2019
1 parent e8325b3 commit 1de8c41
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 6 deletions.
28 changes: 22 additions & 6 deletions m4/np_mysqlclient.m4
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,34 @@ AC_DEFUN([np_mysqlclient],
_savedcppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $np_mysql_include"
dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in
dnl Although -lmysqlclient is duplicated, it is not a problem
AC_CHECK_LIB([mysqlclient], [mysql_init], [
with_mysql=$np_mysql_config
AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile])
], [with_mysql=no], [$np_mysql_libs])
np_check_lib_mysqlclient
CPPFLAGS=$_savedcppflags
fi
fi
])

dnl Test mysql_init using mysqlclient
AC_DEFUN([np_check_lib_mysqlclient],
[
dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in
dnl Although -lmysqlclient is duplicated, it is not a problem
AC_CHECK_LIB([mysqlclient], [mysql_init], [
with_mysql=$np_mysql_config
AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile])
], [np_check_lib_mariadbclient], [$np_mysql_libs])
])

dnl Test mysql_init using mariadbclient
AC_DEFUN([np_check_lib_mariadbclient],
[
AC_CHECK_LIB([mariadbclient], [mysql_init], [
with_mysql=$np_mysql_config
AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mariadbclient is found and can compile])
], [with_mysql=no], [$np_mysql_libs])
])

dnl Will take $1, find last occurrance of -LDIR and add DIR to LD_RUN_PATH
AC_DEFUN([np_add_to_runpath],
[
Expand Down
45 changes: 45 additions & 0 deletions nagiosplug_mariadbclient.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/m4/np_mysqlclient.m4 b/m4/np_mysqlclient.m4
index c2a4d2a7..5099a02b 100644
--- a/m4/np_mysqlclient.m4
+++ b/m4/np_mysqlclient.m4
@@ -53,18 +53,34 @@ AC_DEFUN([np_mysqlclient],
_savedcppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $np_mysql_include"

- dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in
- dnl Although -lmysqlclient is duplicated, it is not a problem
- AC_CHECK_LIB([mysqlclient], [mysql_init], [
- with_mysql=$np_mysql_config
- AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile])
- ], [with_mysql=no], [$np_mysql_libs])
+ np_check_lib_mysqlclient
+
CPPFLAGS=$_savedcppflags

fi
fi
])

+dnl Test mysql_init using mysqlclient
+AC_DEFUN([np_check_lib_mysqlclient],
+[
+ dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in
+ dnl Although -lmysqlclient is duplicated, it is not a problem
+ AC_CHECK_LIB([mysqlclient], [mysql_init], [
+ with_mysql=$np_mysql_config
+ AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile])
+ ], [np_check_lib_mariadbclient], [$np_mysql_libs])
+])
+
+dnl Test mysql_init using mariadbclient
+AC_DEFUN([np_check_lib_mariadbclient],
+[
+ AC_CHECK_LIB([mariadbclient], [mysql_init], [
+ with_mysql=$np_mysql_config
+ AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mariadbclient is found and can compile])
+ ], [with_mysql=no], [$np_mysql_libs])
+])
+
dnl Will take $1, find last occurrance of -LDIR and add DIR to LD_RUN_PATH
AC_DEFUN([np_add_to_runpath],
[

0 comments on commit 1de8c41

Please sign in to comment.