xref: /php-src/ext/pdo_dblib/config.m4 (revision 82c4db61)
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  AS_VAR_IF([PHP_PDO_DBLIB], [yes], [
8    dnl FreeTDS must be on the default system include/library path.
9    dnl Only perform a sanity check that this is really the case.
10    PHP_CHECK_LIBRARY([sybdb], [dbsqlexec],
11      [],
12      [AC_MSG_FAILURE([Cannot find FreeTDS in known installation directories.])])
13    PHP_ADD_LIBRARY([sybdb],, [PDO_DBLIB_SHARED_LIBADD])
14  ], [
15    if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
16      PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
17      PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include
18    elif test -f $PHP_PDO_DBLIB/include/freetds/sybdb.h; then
19      PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
20      PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include/freetds
21    else
22      AC_MSG_ERROR([Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory])
23    fi
24
25    if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
26       AC_MSG_ERROR([[Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so]]])
27    fi
28
29    PHP_ADD_INCLUDE([$PDO_FREETDS_INCLUDE_DIR])
30    PHP_ADD_LIBRARY_WITH_PATH([sybdb],
31      [$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR],
32      [PDO_DBLIB_SHARED_LIBADD])
33  ])
34
35  PHP_CHECK_PDO_INCLUDES
36
37  PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
38  PHP_NEW_EXTENSION([pdo_dblib],
39    [pdo_dblib.c dblib_driver.c dblib_stmt.c],
40    [$ext_shared],,
41    [$PDO_DBLIB_DEFS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
42  PHP_SUBST([PDO_DBLIB_SHARED_LIBADD])
43
44  PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo)
45fi
46