1dnl 2dnl $Id$ 3dnl 4 5AC_DEFUN([MYSQL_LIB_CHK], [ 6 str="$MYSQL_DIR/$1/lib$MYSQL_LIBNAME.*" 7 for j in `echo $str`; do 8 if test -r $j; then 9 MYSQL_LIB_DIR=$MYSQL_DIR/$1 10 break 2 11 fi 12 done 13]) 14 15AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [ 16 for i in \ 17 /var/run/mysqld/mysqld.sock \ 18 /var/tmp/mysql.sock \ 19 /var/run/mysql/mysql.sock \ 20 /var/lib/mysql/mysql.sock \ 21 /var/mysql/mysql.sock \ 22 /usr/local/mysql/var/mysql.sock \ 23 /Private/tmp/mysql.sock \ 24 /private/tmp/mysql.sock \ 25 /tmp/mysql.sock \ 26 ; do 27 if test -r $i; then 28 MYSQL_SOCK=$i 29 break 2 30 fi 31 done 32 33 if test -n "$MYSQL_SOCK"; then 34 AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ]) 35 AC_MSG_RESULT([$MYSQL_SOCK]) 36 else 37 AC_MSG_RESULT([no]) 38 fi 39]) 40 41 42PHP_ARG_WITH(mysql, for MySQL support, 43[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base 44 directory, if no DIR is passed or the value is 45 mysqlnd the MySQL native driver will be used]) 46 47PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket, 48[ --with-mysql-sock[=SOCKPATH] 49 MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. 50 If unspecified, the default locations are searched], no, no) 51 52if test -z "$PHP_ZLIB_DIR"; then 53 PHP_ARG_WITH(zlib-dir, for the location of libz, 54 [ --with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix], no, no) 55fi 56 57if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then 58 dnl enables build of mysqnd library 59 PHP_MYSQLND_ENABLED=yes 60 61elif test "$PHP_MYSQL" != "no"; then 62 MYSQL_DIR= 63 MYSQL_INC_DIR= 64 65 if test -r $PHP_MYSQL/include/mysql/mysql.h; then 66 MYSQL_DIR=$PHP_MYSQL 67 MYSQL_INC_DIR=$PHP_MYSQL/include/mysql 68 break 69 elif test -r $PHP_MYSQL/include/mysql.h; then 70 MYSQL_DIR=$PHP_MYSQL 71 MYSQL_INC_DIR=$PHP_MYSQL/include 72 break 73 fi 74 75 if test -z "$MYSQL_DIR"; then 76 AC_MSG_ERROR([Cannot find MySQL header files under $PHP_MYSQL. 77Note that the MySQL client library is not bundled anymore!]) 78 fi 79 80 if test "$enable_maintainer_zts" = "yes"; then 81 MYSQL_LIBNAME=mysqlclient_r 82 else 83 MYSQL_LIBNAME=mysqlclient 84 fi 85 case $host_alias in 86 *netware*[)] 87 MYSQL_LIBNAME=mysql 88 ;; 89 esac 90 91 dnl for compat with PHP 4 build system 92 if test -z "$PHP_LIBDIR"; then 93 PHP_LIBDIR=lib 94 fi 95 96 for i in $PHP_LIBDIR $PHP_LIBDIR/mysql; do 97 MYSQL_LIB_CHK($i) 98 done 99 100 if test -z "$MYSQL_LIB_DIR"; then 101 MYSQL_LIB_CHK(lib/x86_64-linux-gnu) 102 fi 103 if test -z "$MYSQL_LIB_DIR"; then 104 MYSQL_LIB_CHK(lib/i386-linux-gnu) 105 fi 106 107 if test -z "$MYSQL_LIB_DIR"; then 108 AC_MSG_ERROR([Cannot find lib$MYSQL_LIBNAME under $MYSQL_DIR. 109Note that the MySQL client library is not bundled anymore!]) 110 fi 111 112 PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_close, [ ], 113 [ 114 if test "$PHP_ZLIB_DIR" != "no"; then 115 PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQL_SHARED_LIBADD) 116 PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_error, [], [ 117 AC_MSG_ERROR([mysql configure failed. Please check config.log for more information.]) 118 ], [ 119 -L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$MYSQL_LIB_DIR 120 ]) 121 MYSQL_LIBS="-L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz" 122 else 123 PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD) 124 PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_errno, [], [ 125 AC_MSG_ERROR([Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.]) 126 ], [ 127 -L$MYSQL_LIB_DIR 128 ]) 129 MYSQL_LIBS="-lz" 130 fi 131 ], [ 132 -L$MYSQL_LIB_DIR 133 ]) 134 135 PHP_ADD_LIBRARY_WITH_PATH($MYSQL_LIBNAME, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD) 136 PHP_ADD_INCLUDE($MYSQL_INC_DIR) 137 138 MYSQL_MODULE_TYPE=external 139 MYSQL_LIBS="-L$MYSQL_LIB_DIR -l$MYSQL_LIBNAME $MYSQL_LIBS" 140 MYSQL_INCLUDE=-I$MYSQL_INC_DIR 141 142 PHP_SUBST_OLD(MYSQL_MODULE_TYPE) 143 PHP_SUBST_OLD(MYSQL_LIBS) 144 PHP_SUBST_OLD(MYSQL_INCLUDE) 145fi 146 147dnl Enable extension 148if test "$PHP_MYSQL" != "no"; then 149 AC_MSG_CHECKING([for MySQL UNIX socket location]) 150 if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then 151 MYSQL_SOCK=$PHP_MYSQL_SOCK 152 AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ]) 153 AC_MSG_RESULT([$MYSQL_SOCK]) 154 elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then 155 PHP_MYSQL_SOCKET_SEARCH 156 else 157 AC_MSG_RESULT([no]) 158 fi 159 160 AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL]) 161 PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared) 162 PHP_SUBST(MYSQL_SHARED_LIBADD) 163 164 if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then 165 PHP_ADD_EXTENSION_DEP(mysql, mysqlnd) 166 AC_DEFINE([MYSQL_USE_MYSQLND], 1, [Whether mysqlnd is enabled]) 167 fi 168fi 169