config.m4 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. PHP_ARG_WITH([pdo-dblib],
  2. [for PDO_DBLIB support via FreeTDS],
  3. [AS_HELP_STRING([[--with-pdo-dblib[=DIR]]],
  4. [PDO: DBLIB-DB support. DIR is the FreeTDS home directory])])
  5. if test "$PHP_PDO_DBLIB" != "no"; then
  6. if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
  7. AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
  8. fi
  9. if test "$PHP_PDO_DBLIB" = "yes"; then
  10. dnl FreeTDS must be on the default system include/library path.
  11. dnl Only perform a sanity check that this is really the case.
  12. PHP_CHECK_LIBRARY(sybdb, dbsqlexec,
  13. [],[
  14. AC_MSG_ERROR([Cannot find FreeTDS in known installation directories])
  15. ])
  16. PHP_ADD_LIBRARY(sybdb,,PDO_DBLIB_SHARED_LIBADD)
  17. elif test "$PHP_PDO_DBLIB" != "no"; then
  18. if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
  19. PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
  20. PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include
  21. elif test -f $PHP_PDO_DBLIB/include/freetds/sybdb.h; then
  22. PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
  23. PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include/freetds
  24. else
  25. AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory)
  26. fi
  27. if test "x$PHP_LIBDIR" = "x" ; then
  28. PHP_LIBDIR=lib
  29. fi
  30. if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
  31. AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
  32. fi
  33. PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR)
  34. PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD)
  35. fi
  36. PHP_CHECK_PDO_INCLUDES
  37. PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
  38. PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_DBLIB_DEFS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
  39. AC_CHECK_LIB(dnet_stub, dnet_addr, [
  40. PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,PDO_DBLIB_SHARED_LIBADD)
  41. ])
  42. AC_DEFINE(HAVE_PDO_DBLIB,1,[ ])
  43. PHP_SUBST(PDO_DBLIB_SHARED_LIBADD)
  44. PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo)
  45. fi