config.m4 2.8 KB

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