xref: /PHP-8.3/ext/mysqli/config.m4 (revision d84dfa32)
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 2
17    fi
18  done
19
20  if test -n "$MYSQL_SOCK"; then
21    AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
22    AC_MSG_RESULT([$MYSQL_SOCK])
23  else
24    AC_MSG_RESULT([no])
25  fi
26])
27
28PHP_ARG_WITH([mysqli],
29  [for MySQLi support],
30  [AS_HELP_STRING([[--with-mysqli]],
31    [Include MySQLi support. The MySQL native driver will be used])])
32
33dnl ext/pdo_mysql/config.m4 also depends on this configure option.
34PHP_ARG_WITH([mysql-sock],
35  [for specified location of the MySQL UNIX socket],
36  [AS_HELP_STRING([[--with-mysql-sock[=SOCKPATH]]],
37    [MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. If unspecified,
38    the default locations are searched])],
39  [no],
40  [no])
41
42if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then
43  dnl This needs to be set in any extension which wishes to use mysqlnd
44  PHP_MYSQLND_ENABLED=yes
45
46elif test "$PHP_MYSQLI" != "no"; then
47  AC_MSG_ERROR([Linking mysqli against external library is no longer supported])
48fi
49
50dnl Build extension
51if test "$PHP_MYSQLI" != "no"; then
52  AC_MSG_CHECKING([for MySQL UNIX socket location])
53  if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
54    MYSQL_SOCK=$PHP_MYSQL_SOCK
55    AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
56    AC_MSG_RESULT([$MYSQL_SOCK])
57  elif test "$PHP_MYSQL_SOCK" = "yes"; then
58    PHP_MYSQL_SOCKET_SEARCH
59  else
60    AC_MSG_RESULT([no])
61  fi
62
63  mysqli_sources="mysqli.c mysqli_api.c mysqli_prop.c mysqli_nonapi.c \
64                  mysqli_report.c mysqli_driver.c mysqli_warning.c \
65                  mysqli_exception.c mysqli_result_iterator.c"
66  PHP_NEW_EXTENSION(mysqli, $mysqli_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
67  PHP_SUBST(MYSQLI_SHARED_LIBADD)
68  PHP_INSTALL_HEADERS([ext/mysqli/php_mysqli_structs.h])
69
70  if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then
71    PHP_ADD_EXTENSION_DEP(mysqli, mysqlnd)
72    PHP_INSTALL_HEADERS([ext/mysqli/mysqli_mysqlnd.h])
73  fi
74fi
75