1dnl 2dnl $Id$ 3dnl config.m4 for extension mysqli 4 5PHP_ARG_WITH(mysqli, for MySQLi support, 6[ --with-mysqli[=FILE] Include MySQLi support. FILE is the path 7 to mysql_config. If mysqlnd is passed as FILE, 8 the MySQL native driver will be used [mysql_config]]) 9 10PHP_ARG_ENABLE(embedded_mysqli, whether to enable embedded MySQLi support, 11[ --enable-embedded-mysqli MYSQLi: Enable embedded support 12 Note: Does not work with MySQL native driver!], no, no) 13 14if test "$PHP_MYSQLI" = "mysqlnd"; then 15 dnl This needs to be set in any extension which wishes to use mysqlnd 16 PHP_MYSQLND_ENABLED=yes 17 18elif test "$PHP_MYSQLI" != "no"; then 19 20 if test "$PHP_MYSQLI" = "yes"; then 21 MYSQL_CONFIG=`$php_shtool path mysql_config` 22 else 23 MYSQL_CONFIG=$PHP_MYSQLI 24 fi 25 26 MYSQL_LIB_NAME='mysqlclient' 27 if test "$PHP_EMBEDDED_MYSQLI" = "yes"; then 28 AC_DEFINE(HAVE_EMBEDDED_MYSQLI, 1, [embedded MySQL support enabled]) 29 MYSQL_LIB_CFG='--libmysqld-libs' 30 dnl mysqlnd doesn't support embedded, so we have to add some extra stuff 31 mysqli_extra_sources="mysqli_embedded.c" 32 elif test "$enable_maintainer_zts" = "yes"; then 33 MYSQL_LIB_CFG='--libs_r' 34 MYSQL_LIB_NAME='mysqlclient_r' 35 else 36 MYSQL_LIB_CFG='--libs' 37 fi 38 39 if test -x "$MYSQL_CONFIG" && $MYSQL_CONFIG $MYSQL_LIB_CFG > /dev/null 2>&1; then 40 MYSQLI_INCLINE=`$MYSQL_CONFIG --cflags | $SED -e "s/'//g"` 41 MYSQLI_LIBLINE=`$MYSQL_CONFIG $MYSQL_LIB_CFG | $SED -e "s/'//g"` 42 else 43 AC_MSG_RESULT([mysql_config not found]) 44 AC_MSG_ERROR([Please reinstall the mysql distribution]) 45 fi 46 47 dnl 48 dnl Check the library 49 dnl 50 PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_set_server_option, 51 [ 52 PHP_EVAL_INCLINE($MYSQLI_INCLINE) 53 PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD) 54 AC_DEFINE(HAVE_MYSQLILIB, 1, [ ]) 55 PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_set_character_set, 56 [ ],[ 57 AC_MSG_ERROR([MySQLI doesn't support versions < 4.1.13 (for MySQL 4.1.x) and < 5.0.7 for (MySQL 5.0.x) anymore. Please update your libraries.]) 58 ],[$MYSQLI_LIBLINE]) 59 ],[ 60 AC_MSG_ERROR([wrong mysql library version or lib not found. Check config.log for more information.]) 61 ],[ 62 $MYSQLI_LIBLINE 63 ]) 64 dnl 65 dnl Check the library for mysql_stmt_next_result 66 dnl 67 PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_stmt_next_result, 68 [ 69 AC_DEFINE(HAVE_STMT_NEXT_RESULT, 1, [ ]) 70 ],[ 71 ],[ 72 $MYSQLI_LIBLINE 73 ]) 74fi 75 76dnl Build extension 77if test "$PHP_MYSQLI" != "no"; then 78 mysqli_sources="mysqli.c mysqli_api.c mysqli_prop.c mysqli_nonapi.c \ 79 mysqli_fe.c mysqli_report.c mysqli_driver.c mysqli_warning.c \ 80 mysqli_exception.c $mysqli_extra_sources" 81 PHP_NEW_EXTENSION(mysqli, $mysqli_sources, $ext_shared) 82 PHP_SUBST(MYSQLI_SHARED_LIBADD) 83 PHP_INSTALL_HEADERS([ext/mysqli/php_mysqli_structs.h]) 84 85 if test "$PHP_MYSQLI" = "mysqlnd"; then 86 PHP_ADD_EXTENSION_DEP(mysqli, mysqlnd) 87 AC_DEFINE([MYSQLI_USE_MYSQLND], 1, [Whether mysqlnd is enabled]) 88 fi 89fi 90