config.m4 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. dnl
  2. dnl $Id$
  3. dnl
  4. PHP_ARG_WITH(pdo-dblib, for PDO_DBLIB support via FreeTDS,
  5. [ --with-pdo-dblib[=DIR] PDO: DBLIB-DB support. DIR is the FreeTDS home directory])
  6. if test "$PHP_PDO_DBLIB" != "no"; then
  7. if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
  8. AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
  9. fi
  10. if test "$PHP_PDO_DBLIB" = "yes"; then
  11. for i in /usr/local /usr; do
  12. if test -f $i/include/sybdb.h; then
  13. PDO_FREETDS_INSTALLATION_DIR=$i
  14. PDO_FREETDS_INCLUDE_DIR=$i/include
  15. break
  16. elif test -f $i/include/freetds/sybdb.h; then
  17. PDO_FREETDS_INSTALLATION_DIR=$i
  18. PDO_FREETDS_INCLUDE_DIR=$i/include/freetds
  19. break;
  20. fi
  21. done
  22. if test -z "$PDO_FREETDS_INSTALLATION_DIR"; then
  23. AC_MSG_ERROR(Cannot find FreeTDS in known installation directories)
  24. fi
  25. elif test "$PHP_PDO_DBLIB" != "no"; then
  26. if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
  27. PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
  28. PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include
  29. elif test -f $PHP_PDO_DBLIB/include/freetds/sybdb.h; then
  30. PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
  31. PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include/freetds
  32. else
  33. AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory)
  34. fi
  35. fi
  36. if test "x$PHP_LIBDIR" = "x" ; then
  37. PHP_LIBDIR=lib
  38. fi
  39. if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
  40. AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
  41. fi
  42. PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR)
  43. PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD)
  44. ifdef([PHP_CHECK_PDO_INCLUDES],
  45. [
  46. PHP_CHECK_PDO_INCLUDES
  47. ],[
  48. AC_MSG_CHECKING([for PDO includes])
  49. if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
  50. pdo_cv_inc_path=$abs_srcdir/ext
  51. elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
  52. pdo_cv_inc_path=$abs_srcdir/ext
  53. elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
  54. pdo_cv_inc_path=$prefix/include/php/ext
  55. else
  56. AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
  57. fi
  58. AC_MSG_RESULT($pdo_cv_inc_path)
  59. ])
  60. PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
  61. PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_DBLIB_DEFS)
  62. AC_CHECK_LIB(dnet_stub, dnet_addr,
  63. [ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,PDO_DBLIB_SHARED_LIBADD)
  64. AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
  65. ])
  66. AC_DEFINE(HAVE_PDO_DBLIB,1,[ ])
  67. AC_DEFINE(HAVE_FREETDS,1,[ ])
  68. PHP_SUBST(PDO_DBLIB_SHARED_LIBADD)
  69. ifdef([PHP_ADD_EXTENSION_DEP],
  70. [
  71. PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo)
  72. ])
  73. fi