xref: /PHP-7.4/ext/pdo_dblib/config.m4 (revision 1b969a74)
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
14    for i in /usr/local /usr; do
15      if test -f $i/include/sybdb.h; then
16        PDO_FREETDS_INSTALLATION_DIR=$i
17        PDO_FREETDS_INCLUDE_DIR=$i/include
18        break
19      elif test -f $i/include/freetds/sybdb.h; then
20        PDO_FREETDS_INSTALLATION_DIR=$i
21        PDO_FREETDS_INCLUDE_DIR=$i/include/freetds
22        break;
23      fi
24    done
25
26    if test -z "$PDO_FREETDS_INSTALLATION_DIR"; then
27      AC_MSG_ERROR(Cannot find FreeTDS in known installation directories)
28    fi
29
30  elif test "$PHP_PDO_DBLIB" != "no"; then
31
32    if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
33      PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
34      PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include
35    elif test -f $PHP_PDO_DBLIB/include/freetds/sybdb.h; then
36      PDO_FREETDS_INSTALLATION_DIR=$PHP_PDO_DBLIB
37      PDO_FREETDS_INCLUDE_DIR=$PHP_PDO_DBLIB/include/freetds
38    else
39      AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory)
40    fi
41  fi
42
43  if test "x$PHP_LIBDIR" = "x" ; then
44    PHP_LIBDIR=lib
45  fi
46
47  if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
48     AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
49  fi
50
51  PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR)
52  PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD)
53
54  PHP_CHECK_PDO_INCLUDES
55
56  PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
57  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)
58  AC_CHECK_LIB(dnet_stub, dnet_addr, [
59    PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,PDO_DBLIB_SHARED_LIBADD)
60  ])
61  AC_DEFINE(HAVE_PDO_DBLIB,1,[ ])
62  PHP_SUBST(PDO_DBLIB_SHARED_LIBADD)
63
64  PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo)
65fi
66