Detect SSL_MODE_DISABLED at configure time, to make the component compile on older mysql clients.
[GB.DB.MYSQL] * BUG: Detect SSL_MODE_DISABLED at configure time, to make the component compile on older mysql clients.
This commit is contained in:
parent
1e7d80c8a1
commit
08efaddf79
@ -13,7 +13,29 @@ GB_COMPONENT(
|
|||||||
[GB_FIND(mysql.h, $prefix /opt/local /opt /usr/local/lib /usr/local /usr/lib /usr, include mysql*/include)],
|
[GB_FIND(mysql.h, $prefix /opt/local /opt /usr/local/lib /usr/local /usr/lib /usr, include mysql*/include)],
|
||||||
[GB_FIND(libmysqlclient.$SHLIBEXT, $prefix /opt/local /opt /usr/local /usr, lib mysql*/lib)],
|
[GB_FIND(libmysqlclient.$SHLIBEXT, $prefix /opt/local /opt /usr/local /usr, lib mysql*/lib)],
|
||||||
[$C_LIB -lmysqlclient -lz])
|
[$C_LIB -lmysqlclient -lz])
|
||||||
|
|
||||||
|
gb_save_cppflags=$CPPFLAGS
|
||||||
|
CPPFLAGS=$MYSQL_INC
|
||||||
|
|
||||||
|
AC_CACHE_CHECK(for SSL mode option,
|
||||||
|
gb_cv_db_mysql_ssl_mode,
|
||||||
|
[AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
#include <mysql.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
int flag = SSL_MODE_DISABLED;
|
||||||
|
],
|
||||||
|
gb_cv_db_mysql_ssl_mode=yes, gb_cv_db_mysql_ssl_mode=no
|
||||||
|
)])
|
||||||
|
|
||||||
|
if test $gb_cv_db_mysql_ssl_mode = yes; then
|
||||||
|
AC_DEFINE(HAVE_MYSQL_SSL_MODE_DISABLED, 1, [Define if you have SSL_MODE_DISABLED constant.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
CPPFLAGS=$gb_save_cppflags
|
||||||
|
|
||||||
|
|
||||||
AC_OUTPUT( \
|
AC_OUTPUT( \
|
||||||
Makefile \
|
Makefile \
|
||||||
src/Makefile \
|
src/Makefile \
|
||||||
|
@ -739,9 +739,11 @@ static int open_database(DB_DESC *desc, DB_DATABASE *db)
|
|||||||
char *host;
|
char *host;
|
||||||
char *socket;
|
char *socket;
|
||||||
my_bool reconnect = TRUE;
|
my_bool reconnect = TRUE;
|
||||||
unsigned int mode;
|
|
||||||
unsigned int timeout;
|
unsigned int timeout;
|
||||||
|
#if HAVE_MYSQL_SSL_MODE_DISABLED
|
||||||
char *env;
|
char *env;
|
||||||
|
unsigned int mode;
|
||||||
|
#endif
|
||||||
|
|
||||||
conn = mysql_init(NULL);
|
conn = mysql_init(NULL);
|
||||||
|
|
||||||
@ -766,7 +768,7 @@ static int open_database(DB_DESC *desc, DB_DATABASE *db)
|
|||||||
timeout = db->timeout;
|
timeout = db->timeout;
|
||||||
mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout);
|
mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout);
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 80000
|
#if HAVE_MYSQL_SSL_MODE_DISABLED
|
||||||
env = getenv("GB_DB_MYSQL_NOSSL");
|
env = getenv("GB_DB_MYSQL_NOSSL");
|
||||||
if (env && strcmp(env, "0"))
|
if (env && strcmp(env, "0"))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user