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 no value or mysqlnd is passed 8 as FILE, the MySQL native driver will be used]) 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" = "yes" || 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 MYSQL_CONFIG=$PHP_MYSQLI 21 22 MYSQL_LIB_NAME='mysqlclient' 23 if test "$PHP_EMBEDDED_MYSQLI" = "yes"; then 24 AC_DEFINE(HAVE_EMBEDDED_MYSQLI, 1, [embedded MySQL support enabled]) 25 MYSQL_LIB_CFG='--libmysqld-libs' 26 dnl mysqlnd doesn't support embedded, so we have to add some extra stuff 27 mysqli_extra_sources="mysqli_embedded.c" 28 elif test "$enable_maintainer_zts" = "yes"; then 29 MYSQL_LIB_CFG='--libs_r' 30 MYSQL_LIB_NAME='mysqlclient_r' 31 else 32 MYSQL_LIB_CFG='--libs' 33 fi 34 35 if test -x "$MYSQL_CONFIG" && $MYSQL_CONFIG $MYSQL_LIB_CFG > /dev/null 2>&1; then 36 MYSQLI_INCLINE=`$MYSQL_CONFIG --cflags | $SED -e "s/'//g"` 37 MYSQLI_LIBLINE=`$MYSQL_CONFIG $MYSQL_LIB_CFG | $SED -e "s/'//g"` 38 else 39 AC_MSG_RESULT([mysql_config not found]) 40 AC_MSG_ERROR([Please reinstall the mysql distribution]) 41 fi 42 43 dnl 44 dnl Check the library 45 dnl 46 PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_set_server_option, 47 [ 48 PHP_EVAL_INCLINE($MYSQLI_INCLINE) 49 PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD) 50 AC_DEFINE(HAVE_MYSQLILIB, 1, [ ]) 51 PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_set_character_set, 52 [ ],[ 53 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.]) 54 ],[$MYSQLI_LIBLINE]) 55 ],[ 56 AC_MSG_ERROR([wrong mysql library version or lib not found. Check config.log for more information.]) 57 ],[ 58 $MYSQLI_LIBLINE 59 ]) 60 dnl 61 dnl Check the library for mysql_stmt_next_result 62 dnl 63 PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_stmt_next_result, 64 [ 65 AC_DEFINE(HAVE_STMT_NEXT_RESULT, 1, [ ]) 66 ],[ 67 ],[ 68 $MYSQLI_LIBLINE 69 ]) 70fi 71 72dnl Build extension 73if test "$PHP_MYSQLI" != "no"; then 74 mysqli_sources="mysqli.c mysqli_api.c mysqli_prop.c mysqli_nonapi.c \ 75 mysqli_fe.c mysqli_report.c mysqli_driver.c mysqli_warning.c \ 76 mysqli_exception.c mysqli_result_iterator.c $mysqli_extra_sources" 77 PHP_NEW_EXTENSION(mysqli, $mysqli_sources, $ext_shared) 78 PHP_SUBST(MYSQLI_SHARED_LIBADD) 79 PHP_INSTALL_HEADERS([ext/mysqli/php_mysqli_structs.h]) 80 81 if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then 82 PHP_ADD_EXTENSION_DEP(mysqli, mysqlnd) 83 AC_DEFINE([MYSQLI_USE_MYSQLND], 1, [Whether mysqlnd is enabled]) 84 PHP_INSTALL_HEADERS([ext/mysqli/mysqli_mysqlnd.h]) 85 else 86 PHP_INSTALL_HEADERS([ext/mysqli/mysqli_libmysql.h]) 87 fi 88fi 89