config.m4 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. PHP_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. if test -z "$PHP_ZLIB_DIR"; then
  7. PHP_ARG_WITH([zlib-dir],
  8. [for the location of libz],
  9. [AS_HELP_STRING([[--with-zlib-dir[=DIR]]],
  10. [PDO_MySQL: Set the path to libz install prefix])],
  11. [no],
  12. [no])
  13. fi
  14. if test "$PHP_PDO_MYSQL" != "no"; then
  15. dnl This depends on ext/mysqli/config.m4 providing the PHP_MYSQL_SOCKET_SEARCH
  16. dnl macro and --with-mysql-sock configure option.
  17. AC_MSG_CHECKING([for MySQL UNIX socket location])
  18. if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
  19. MYSQL_SOCK=$PHP_MYSQL_SOCK
  20. AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
  21. AC_MSG_RESULT([$MYSQL_SOCK])
  22. elif test "$PHP_MYSQL_SOCK" = "yes"; then
  23. PHP_MYSQL_SOCKET_SEARCH
  24. else
  25. AC_MSG_RESULT([no])
  26. fi
  27. if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
  28. AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
  29. fi
  30. if test "$PHP_PDO_MYSQL" != "yes" && test "$PHP_PDO_MYSQL" != "mysqlnd"; then
  31. if test -f $PHP_PDO_MYSQL && test -x $PHP_PDO_MYSQL ; then
  32. PDO_MYSQL_CONFIG=$PHP_PDO_MYSQL
  33. else
  34. if test -d "$PHP_PDO_MYSQL" ; then
  35. if test -x "$PHP_PDO_MYSQL/bin/mysql_config" ; then
  36. PDO_MYSQL_CONFIG="$PHP_PDO_MYSQL/bin/mysql_config"
  37. else
  38. PDO_MYSQL_DIR="$PHP_PDO_MYSQL"
  39. fi
  40. fi
  41. fi
  42. fi
  43. if test "$PHP_PDO_MYSQL" = "yes" || test "$PHP_PDO_MYSQL" = "mysqlnd"; then
  44. dnl enables build of mysqnd library
  45. PHP_MYSQLND_ENABLED=yes
  46. AC_DEFINE([PDO_USE_MYSQLND], 1, [Whether pdo_mysql uses mysqlnd])
  47. else
  48. AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
  49. AC_MSG_CHECKING([for mysql_config])
  50. if test -n "$PDO_MYSQL_CONFIG"; then
  51. AC_MSG_RESULT($PDO_MYSQL_CONFIG)
  52. if test "x$SED" = "x"; then
  53. AC_PATH_PROG(SED, sed)
  54. fi
  55. PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs | $SED -e "s/'//g"`
  56. PDO_MYSQL_INCLUDE=`$PDO_MYSQL_CONFIG --cflags | $SED -e "s/'//g"`
  57. elif test -n "$PDO_MYSQL_DIR"; then
  58. AC_MSG_RESULT([not found])
  59. AC_MSG_CHECKING([for mysql install under $PDO_MYSQL_DIR])
  60. if test -r $PDO_MYSQL_DIR/include/mysql; then
  61. PDO_MYSQL_INC_DIR=$PDO_MYSQL_DIR/include/mysql
  62. else
  63. PDO_MYSQL_INC_DIR=$PDO_MYSQL_DIR/include
  64. fi
  65. if test -r $PDO_MYSQL_DIR/$PHP_LIBDIR/mysql; then
  66. PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$PHP_LIBDIR/mysql
  67. else
  68. PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$PHP_LIBDIR
  69. fi
  70. if test -r "$PDO_MYSQL_LIB_DIR"; then
  71. AC_MSG_RESULT([libs under $PDO_MYSQL_LIB_DIR; seems promising])
  72. else
  73. AC_MSG_RESULT([can not find it])
  74. AC_MSG_ERROR([Unable to find your mysql installation])
  75. fi
  76. PHP_ADD_INCLUDE($PDO_MYSQL_INC_DIR)
  77. PDO_MYSQL_INCLUDE=-I$PDO_MYSQL_INC_DIR
  78. else
  79. AC_MSG_RESULT([not found])
  80. AC_MSG_ERROR([Unable to find your mysql installation])
  81. fi
  82. PHP_EVAL_INCLINE($PDO_MYSQL_INCLUDE)
  83. PHP_EVAL_LIBLINE($PDO_MYSQL_LIBS, PDO_MYSQL_SHARED_LIBADD)
  84. fi
  85. PHP_CHECK_PDO_INCLUDES
  86. if test -n "$PDO_MYSQL_CONFIG"; then
  87. PDO_MYSQL_SOCKET=`$PDO_MYSQL_CONFIG --socket`
  88. AC_DEFINE_UNQUOTED(PDO_MYSQL_UNIX_ADDR, "$PDO_MYSQL_SOCKET", [ ])
  89. fi
  90. PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_cv_inc_path -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
  91. PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo)
  92. if test "$PHP_PDO_MYSQL" = "yes" || test "$PHP_PDO_MYSQL" = "mysqlnd"; then
  93. PHP_ADD_EXTENSION_DEP(pdo_mysql, mysqlnd)
  94. fi
  95. PDO_MYSQL_MODULE_TYPE=external
  96. PHP_SUBST(PDO_MYSQL_SHARED_LIBADD)
  97. PHP_SUBST_OLD(PDO_MYSQL_MODULE_TYPE)
  98. fi