1PHP_ARG_WITH([pdo-mysql], 2 [for MySQL support for PDO], 3 [AS_HELP_STRING([[--with-pdo-mysql[=DIR]]], 4 [PDO: MySQL support. DIR is the MySQL base directory. If no value or mysqlnd 5 is passed as DIR, the MySQL native driver will be used])]) 6 7if test "$PHP_PDO_MYSQL" != "no"; then 8 dnl This depends on ext/mysqli/config.m4 providing the PHP_MYSQL_SOCKET_SEARCH 9 dnl macro and --with-mysql-sock configure option. 10 AC_MSG_CHECKING([for MySQL Unix socket location]) 11 AS_CASE([$PHP_MYSQL_SOCK], 12 [yes], [PHP_MYSQL_SOCKET_SEARCH], 13 [no], [AC_MSG_RESULT([no])], 14 [ 15 AC_DEFINE_UNQUOTED([PHP_MYSQL_UNIX_SOCK_ADDR], ["$PHP_MYSQL_SOCK"], 16 [The MySQL Unix socket location.]) 17 AC_MSG_RESULT([$PHP_MYSQL_SOCK]) 18 ]) 19 20 dnl Whether to build with the mysqlnd extension or with the MySQL library. 21 AS_CASE([$PHP_PDO_MYSQL], [yes|mysqlnd], [ 22 PHP_MYSQLND_ENABLED=yes 23 AC_DEFINE([PDO_USE_MYSQLND], [1], 24 [Define to 1 if the pdo_mysql extension uses mysqlnd.]) 25 ], [ 26 AC_MSG_CHECKING([for mysql_config]) 27 if test -f $PHP_PDO_MYSQL && test -x $PHP_PDO_MYSQL ; then 28 PDO_MYSQL_CONFIG=$PHP_PDO_MYSQL 29 else 30 if test -d "$PHP_PDO_MYSQL" ; then 31 if test -x "$PHP_PDO_MYSQL/bin/mysql_config" ; then 32 PDO_MYSQL_CONFIG="$PHP_PDO_MYSQL/bin/mysql_config" 33 else 34 PDO_MYSQL_DIR="$PHP_PDO_MYSQL" 35 fi 36 fi 37 fi 38 39 if test -n "$PDO_MYSQL_CONFIG"; then 40 AC_MSG_RESULT([$PDO_MYSQL_CONFIG]) 41 PDO_MYSQL_LIBS=$($PDO_MYSQL_CONFIG --libs | $SED -e "s/'//g") 42 PDO_MYSQL_INCLUDE=$($PDO_MYSQL_CONFIG --cflags | $SED -e "s/'//g") 43 PDO_MYSQL_SOCKET=$($PDO_MYSQL_CONFIG --socket) 44 AC_DEFINE_UNQUOTED([PDO_MYSQL_UNIX_ADDR], ["$PDO_MYSQL_SOCKET"], 45 [The MySQL Unix socket location as defined by 'mysql_config' for use 46 with the pdo_mysql extension.]) 47 elif test -n "$PDO_MYSQL_DIR"; then 48 AC_MSG_RESULT([not found]) 49 AC_MSG_CHECKING([for mysql install under $PDO_MYSQL_DIR]) 50 if test -r $PDO_MYSQL_DIR/include/mysql; then 51 PDO_MYSQL_INC_DIR=$PDO_MYSQL_DIR/include/mysql 52 else 53 PDO_MYSQL_INC_DIR=$PDO_MYSQL_DIR/include 54 fi 55 if test -r $PDO_MYSQL_DIR/$PHP_LIBDIR/mysql; then 56 PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$PHP_LIBDIR/mysql 57 else 58 PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$PHP_LIBDIR 59 fi 60 61 if test -r "$PDO_MYSQL_LIB_DIR"; then 62 AC_MSG_RESULT([libs under $PDO_MYSQL_LIB_DIR; seems promising]) 63 else 64 AC_MSG_RESULT([can not find it]) 65 AC_MSG_ERROR([Unable to find your mysql installation]) 66 fi 67 68 PDO_MYSQL_INCLUDE=-I$PDO_MYSQL_INC_DIR 69 PDO_MYSQL_LIBS="-L$PDO_MYSQL_LIB_DIR -lmysqlclient" 70 else 71 AC_MSG_RESULT([not found]) 72 AC_MSG_ERROR([Unable to find your mysql installation]) 73 fi 74 75 PHP_EVAL_INCLINE([$PDO_MYSQL_INCLUDE]) 76 PHP_EVAL_LIBLINE([$PDO_MYSQL_LIBS], [PDO_MYSQL_SHARED_LIBADD]) 77 ]) 78 79 PHP_CHECK_PDO_INCLUDES 80 81 PHP_NEW_EXTENSION([pdo_mysql], 82 [pdo_mysql.c mysql_driver.c mysql_statement.c mysql_sql_parser.c], 83 [$ext_shared],, 84 [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) 85 86 PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo) 87 PHP_ADD_MAKEFILE_FRAGMENT 88 89 AS_CASE([$PHP_PDO_MYSQL], [yes|mysqlnd], [ 90 PHP_ADD_EXTENSION_DEP(pdo_mysql, mysqlnd) 91 ]) 92 93 PHP_SUBST([PDO_MYSQL_SHARED_LIBADD]) 94fi 95