Code

mysql: respect mysql_libs when searching for symbol
authorRuben Kerkhof <ruben@tilaa.com>
Sat, 1 Aug 2015 16:59:53 +0000 (18:59 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 11 Sep 2015 20:23:56 +0000 (22:23 +0200)
We always looked in libmysqlclient, but this doesn't
work for compatible databases such as Percona.

Respect the list return by mysql_config --libs_r instead.

Fixes #1098

configure.ac

index 9fbb7a594a34156542248857e2c623853a90e8db..f5acb0a1dcc6a1c62a2785d6820d590c50bdc3b4 100644 (file)
@@ -2621,15 +2621,23 @@ then
        then
                with_libmysql="no ($with_mysql_config failed)"
        else
-               AC_CHECK_LIB(mysqlclient, mysql_init,
+               SAVE_CPPFLAGS="$CPPFLAGS"
+               CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
+               SAVE_LIBS="$LIBS"
+               LIBS="$with_mysql_libs"
+               AC_SEARCH_LIBS([mysql_init],
+                [],
                 [with_libmysql="yes"],
                 [with_libmysql="no (symbol 'mysql_init' not found)"],
-                [$with_mysql_libs])
+                [])
 
-               AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
+               AC_SEARCH_LIBS([mysql_get_server_version],
+                [],
                 [with_libmysql="yes"],
                 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
-                [$with_mysql_libs])
+                [])
+               CPPFLAGS="$SAVE_CPPFLAGS"
+               LIBS="$SAVE_LIBS"
        fi
 fi
 if test "x$with_libmysql" = "xyes"