From 1ba7a6812c8d01b05c063e58bb1790151b47657d Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 1 Jun 2006 19:15:31 +0000 Subject: [PATCH] MFB: #37630 MySQL extensions should link against thread safe client libs if built with ZTS --- ext/mysql/config.m4 | 6 +++++- ext/mysql/php_mysql.c | 13 ------------- ext/mysqli/config.m4 | 8 ++++++-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4 index cad03630b44..84f0e8a9a11 100644 --- a/ext/mysql/config.m4 +++ b/ext/mysql/config.m4 @@ -86,7 +86,11 @@ if test "$PHP_MYSQL" != "no"; then Note that the MySQL client library is not bundled anymore!]) fi - MYSQL_LIBNAME=mysqlclient + if test "$enable_maintainer_zts" = "yes"; then + MYSQL_LIBNAME=mysqlclient_r + else + MYSQL_LIBNAME=mysqlclient + fi case $host_alias in *netware*[)] MYSQL_LIBNAME=mysql diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 52141f5327d..aa0c4cab094 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -385,13 +385,6 @@ ZEND_MODULE_STARTUP_D(mysql) REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); - -#ifdef ZTS -# if MYSQL_VERSION_ID >= 40000 - mysql_thread_init(); -# endif -#endif - return SUCCESS; } /* }}} */ @@ -400,12 +393,6 @@ ZEND_MODULE_STARTUP_D(mysql) */ PHP_MSHUTDOWN_FUNCTION(mysql) { -#ifdef ZTS -# if MYSQL_VERSION_ID >= 40000 - mysql_thread_end(); -# endif -#endif - UNREGISTER_INI_ENTRIES(); return SUCCESS; } diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4 index cfca74b476f..2c1af87054a 100644 --- a/ext/mysqli/config.m4 +++ b/ext/mysqli/config.m4 @@ -22,9 +22,13 @@ dnl fi MYSQL_CONFIG=$PHP_MYSQLI fi + MYSQL_LIB_NAME='mysqlclient' if test "$PHP_EMBEDDED_MYSQLI" = "yes"; then AC_DEFINE(HAVE_EMBEDDED_MYSQLI, 1, [embedded MySQL support enabled]) MYSQL_LIB_CFG='--libmysqld-libs' + elif test "$enable_maintainer_zts" = "yes"; then + MYSQL_LIB_CFG='--libs_r' + MYSQL_LIB_NAME='mysqlclient_r' else MYSQL_LIB_CFG='--libs' fi @@ -40,12 +44,12 @@ dnl fi dnl dnl Check the library dnl - PHP_CHECK_LIBRARY(mysqlclient, mysql_set_server_option, + PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_set_server_option, [ PHP_EVAL_INCLINE($MYSQLI_INCLINE) PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD) AC_DEFINE(HAVE_MYSQLILIB,1,[ ]) - PHP_CHECK_LIBRARY(mysqlclient, mysql_stmt_field_count, + PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_stmt_field_count, [ ],[ AC_MSG_ERROR([MySQLI doesn't support versions < 4.1.3 (for MySQL 4.1.x) and < 5.0.1 for (MySQL 5.0.x) anymore. Please update your libraries.]) ],[$MYSQLI_LIBLINE])