2005-07-12 20:16:02 +08:00
|
|
|
dnl
|
|
|
|
dnl $Id$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
PHP_ARG_WITH(pdo-dblib, for PDO_DBLIB support via FreeTDS,
|
2008-07-25 21:46:24 +08:00
|
|
|
[ --with-pdo-dblib[=DIR] PDO: DBLIB-DB support. DIR is the FreeTDS home directory])
|
2005-07-12 20:16:02 +08:00
|
|
|
|
|
|
|
if test "$PHP_PDO_DBLIB" != "no"; then
|
|
|
|
|
2008-07-25 21:46:24 +08:00
|
|
|
if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
|
|
|
|
AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
|
|
|
|
fi
|
|
|
|
|
2005-07-12 20:16:02 +08:00
|
|
|
if test "$PHP_PDO_DBLIB" = "yes"; then
|
|
|
|
|
|
|
|
for i in /usr/local /usr; do
|
2008-10-04 20:52:58 +08:00
|
|
|
if test -f $i/include/sybdb.h; then
|
2005-07-12 20:16:02 +08:00
|
|
|
PDO_FREETDS_INSTALLATION_DIR=$i
|
2005-11-01 21:12:52 +08:00
|
|
|
PDO_FREETDS_INCLUDE_DIR=$i/include
|
2005-07-12 20:16:02 +08:00
|
|
|
break
|
2008-10-04 20:52:58 +08:00
|
|
|
elif test -f $i/include/freetds/sybdb.h; then
|
2005-11-01 21:12:52 +08:00
|
|
|
PDO_FREETDS_INSTALLATION_DIR=$i
|
|
|
|
PDO_FREETDS_INCLUDE_DIR=$i/include/freetds
|
|
|
|
break;
|
2005-07-12 20:16:02 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$PDO_FREETDS_INSTALLATION_DIR"; then
|
|
|
|
AC_MSG_ERROR(Cannot find FreeTDS in known installation directories)
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif test "$PHP_PDO_DBLIB" != "no"; then
|
|
|
|
|
2008-10-04 20:52:58 +08:00
|
|
|
if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
|
2005-07-12 20:16:02 +08:00
|
|
|
PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
|
2005-11-01 21:12:52 +08:00
|
|
|
PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include
|
2008-10-04 20:52:58 +08:00
|
|
|
elif test -f $PHP_PDO_DBLIB/include/freetds/sybdb.h; then
|
2005-11-01 21:12:52 +08:00
|
|
|
PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
|
|
|
|
PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include/freetds
|
2005-07-12 20:16:02 +08:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2005-07-27 11:12:43 +08:00
|
|
|
if test "x$PHP_LIBDIR" = "x" ; then
|
|
|
|
PHP_LIBDIR=lib
|
|
|
|
fi
|
|
|
|
|
2008-10-04 20:52:58 +08:00
|
|
|
if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
|
|
|
|
AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
|
2005-07-12 20:16:02 +08:00
|
|
|
fi
|
|
|
|
|
2005-11-01 21:12:52 +08:00
|
|
|
PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR)
|
|
|
|
PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD)
|
2005-07-12 20:16:02 +08:00
|
|
|
|
2005-07-27 11:12:43 +08:00
|
|
|
ifdef([PHP_CHECK_PDO_INCLUDES],
|
|
|
|
[
|
|
|
|
PHP_CHECK_PDO_INCLUDES
|
|
|
|
],[
|
|
|
|
AC_MSG_CHECKING([for PDO includes])
|
|
|
|
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:03:29 +08:00
|
|
|
pdo_cv_inc_path=$abs_srcdir/ext
|
2005-07-27 11:12:43 +08:00
|
|
|
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:03:29 +08:00
|
|
|
pdo_cv_inc_path=$abs_srcdir/ext
|
2005-07-27 11:12:43 +08:00
|
|
|
elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:03:29 +08:00
|
|
|
pdo_cv_inc_path=$prefix/include/php/ext
|
2005-07-27 11:12:43 +08:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
|
|
|
|
fi
|
2011-05-15 13:03:29 +08:00
|
|
|
AC_MSG_RESULT($pdo_cv_inc_path)
|
2005-07-27 11:12:43 +08:00
|
|
|
])
|
|
|
|
|
2005-07-12 20:16:02 +08:00
|
|
|
PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
|
2011-05-15 13:03:29 +08:00
|
|
|
PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_DBLIB_DEFS)
|
2005-07-12 20:16:02 +08:00
|
|
|
AC_CHECK_LIB(dnet_stub, dnet_addr,
|
|
|
|
[ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,PDO_DBLIB_SHARED_LIBADD)
|
|
|
|
AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
|
|
|
|
])
|
|
|
|
AC_DEFINE(HAVE_PDO_DBLIB,1,[ ])
|
|
|
|
AC_DEFINE(HAVE_FREETDS,1,[ ])
|
|
|
|
PHP_SUBST(PDO_DBLIB_SHARED_LIBADD)
|
2005-07-27 11:12:43 +08:00
|
|
|
|
2005-09-25 07:23:25 +08:00
|
|
|
ifdef([PHP_ADD_EXTENSION_DEP],
|
2005-07-27 11:12:43 +08:00
|
|
|
[
|
|
|
|
PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo)
|
|
|
|
])
|
2005-07-12 20:16:02 +08:00
|
|
|
fi
|