xref: /php-src/ext/pdo_dblib/config.m4 (revision ccdc21b3)
1PHP_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
6if test "$PHP_PDO_DBLIB" != "no"; then
7
8  if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
9    AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
10  fi
11
12  if test "$PHP_PDO_DBLIB" = "yes"; then
13    dnl FreeTDS must be on the default system include/library path.
14    dnl Only perform a sanity check that this is really the case.
15    PHP_CHECK_LIBRARY(sybdb, dbsqlexec,
16    [],[
17      AC_MSG_ERROR([Cannot find FreeTDS in known installation directories])
18    ])
19    PHP_ADD_LIBRARY(sybdb,,PDO_DBLIB_SHARED_LIBADD)
20  elif test "$PHP_PDO_DBLIB" != "no"; then
21
22    if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
23      PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
24      PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include
25    elif test -f $PHP_PDO_DBLIB/include/freetds/sybdb.h; then
26      PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
27      PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include/freetds
28    else
29      AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory)
30    fi
31
32    if test "x$PHP_LIBDIR" = "x" ; then
33      PHP_LIBDIR=lib
34    fi
35
36    if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
37       AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
38    fi
39
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  fi
43
44  PHP_CHECK_PDO_INCLUDES
45
46  PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
47  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)
48  AC_DEFINE(HAVE_PDO_DBLIB,1,[ ])
49  PHP_SUBST(PDO_DBLIB_SHARED_LIBADD)
50
51  PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo)
52fi
53