From: Sebastian Harl Date: Sat, 1 Nov 2008 10:28:30 +0000 (+0100) Subject: configure, mysql plugin: Check for mysql.h as well. X-Git-Tag: collectd-4.4.5~15 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=23164f56d04219d0dd1b1e4954c3edc0609f0eb8;p=collectd.git configure, mysql plugin: Check for mysql.h as well. Up to now, only mysql/mysql.h has been checked for. However, mysql_config --cflags usually adds the complete path to mysql.h to the include flags. In most setups, mysql/mysql.h can be found in the search path as well (usually the header is available in something like /usr/include/mysql/mysql.h) so this issue has not been found so far. However, if that's not the case, the build will fail. Thanks to Dusty Doris for reporting this. --- diff --git a/configure.in b/configure.in index bc4d3213..6fd080a6 100644 --- a/configure.in +++ b/configure.in @@ -1338,12 +1338,24 @@ then if test $mysql_config_status -ne 0 then - with_libmysql="no" + with_libmysql="no ($with_mysql_config failed)" else SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $with_mysql_cflags" - AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], []) + have_mysql_h="no" + have_mysql_mysql_h="no" + AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"]) + + if test "x$have_mysql_h" = "xno" + then + AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"]) + fi + + if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono" + then + with_libmysql="no (mysql.h not found)" + fi CPPFLAGS="$SAVE_CPPFLAGS" fi @@ -1355,7 +1367,7 @@ then if test $mysql_config_status -ne 0 then - with_libmysql="no" + with_libmysql="no ($with_mysql_config failed)" else AC_CHECK_LIB(mysqlclient, mysql_init, [with_libmysql="yes"], diff --git a/src/mysql.c b/src/mysql.c index aa585d65..30557f61 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -24,7 +24,9 @@ #include "plugin.h" #include "configfile.h" -#ifdef HAVE_MYSQL_MYSQL_H +#ifdef HAVE_MYSQL_H +#include +#elif defined(HAVE_MYSQL_MYSQL_H) #include #endif