xref: /PHP-8.4/ext/mysqli/config.m4 (revision 7e1e450b)
1dnl ext/pdo_mysql/config.m4 also depends on this macro.
2AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [
3  for i in  \
4    /var/run/mysqld/mysqld.sock \
5    /var/tmp/mysql.sock \
6    /var/run/mysql/mysql.sock \
7    /var/lib/mysql/mysql.sock \
8    /var/mysql/mysql.sock \
9    /usr/local/mysql/var/mysql.sock \
10    /Private/tmp/mysql.sock \
11    /private/tmp/mysql.sock \
12    /tmp/mysql.sock \
13  ; do
14    if test -r $i; then
15      MYSQL_SOCK=$i
16      break
17    fi
18  done
19
20  AS_VAR_IF([MYSQL_SOCK],, [AC_MSG_RESULT([no])], [
21    AC_DEFINE_UNQUOTED([PHP_MYSQL_UNIX_SOCK_ADDR], ["$MYSQL_SOCK"],
22      [The MySQL Unix socket location.])
23    AC_MSG_RESULT([$MYSQL_SOCK])
24  ])
25])
26
27PHP_ARG_WITH([mysqli],
28  [for MySQLi support],
29  [AS_HELP_STRING([--with-mysqli],
30    [Include MySQLi support. The MySQL native driver will be used])])
31
32dnl ext/pdo_mysql/config.m4 also depends on this configure option.
33PHP_ARG_WITH([mysql-sock],
34  [for specified location of the MySQL Unix socket],
35  [AS_HELP_STRING([[--with-mysql-sock[=SOCKPATH]]],
36    [MySQLi/PDO_MYSQL: Location of the MySQL Unix socket pointer. If
37    unspecified, the default locations are searched])],
38  [no],
39  [no])
40
41if test "$PHP_MYSQLI" != "no"; then
42  dnl The PHP_MYSQLND_ENABLED variable enables the mysqlnd extension.
43  AS_CASE([$PHP_MYSQLI],
44    [yes|mysqlnd], [PHP_MYSQLND_ENABLED=yes],
45    [AC_MSG_ERROR(m4_text_wrap([
46      Linking mysqli against external library is no longer supported. Replace
47      '--with-mysqli=$PHP_MYSQLI' with '--with-mysqli'.
48    ]))])
49
50  AC_MSG_CHECKING([for MySQL Unix socket location])
51  AS_CASE([$PHP_MYSQL_SOCK],
52    [yes], [PHP_MYSQL_SOCKET_SEARCH],
53    [no], [AC_MSG_RESULT([no])],
54    [
55      AC_DEFINE_UNQUOTED([PHP_MYSQL_UNIX_SOCK_ADDR], ["$PHP_MYSQL_SOCK"])
56      AC_MSG_RESULT([$PHP_MYSQL_SOCK])
57    ])
58
59  PHP_NEW_EXTENSION([mysqli], m4_normalize([
60      mysqli_api.c
61      mysqli_driver.c
62      mysqli_exception.c
63      mysqli_nonapi.c
64      mysqli_prop.c
65      mysqli_report.c
66      mysqli_result_iterator.c
67      mysqli_warning.c
68      mysqli.c
69    ]),
70    [$ext_shared],,
71    [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
72  PHP_INSTALL_HEADERS([ext/mysqli], [php_mysqli_structs.h mysqli_mysqlnd.h])
73  PHP_ADD_EXTENSION_DEP(mysqli, mysqlnd)
74  PHP_ADD_EXTENSION_DEP(mysqli, spl)
75fi
76