xref: /PHP-5.4/ext/mssql/config.m4 (revision e1443682)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_WITH(mssql,for MSSQL support via FreeTDS,
6[  --with-mssql[=DIR]      Include MSSQL-DB support.  DIR is the FreeTDS home
7                          directory [/usr/local/freetds]])
8
9if test "$PHP_MSSQL" != "no"; then
10
11  if test "$PHP_MSSQL" = "yes"; then
12    for i in /usr/local /usr; do
13      if test -f $i/include/sybdb.h; then
14        FREETDS_INSTALLATION_DIR=$i
15        FREETDS_INCLUDE_DIR=$i/include
16        break
17      elif test -f $i/include/freetds/sybdb.h; then
18        FREETDS_INSTALLATION_DIR=$i
19        FREETDS_INCLUDE_DIR=$i/include/freetds
20        break
21      fi
22    done
23
24    if test -z "$FREETDS_INSTALLATION_DIR"; then
25      AC_MSG_ERROR(Cannot find FreeTDS in known installation directories)
26    fi
27
28  elif test "$PHP_MSSQL" != "no"; then
29
30    if test -f $PHP_MSSQL/include/sybdb.h; then
31      FREETDS_INSTALLATION_DIR=$PHP_MSSQL
32      FREETDS_INCLUDE_DIR=$PHP_MSSQL/include
33    elif test -f $PHP_MSSQL/include/freetds/sybdb.h; then
34      FREETDS_INSTALLATION_DIR=$PHP_MSSQL
35      FREETDS_INCLUDE_DIR=$PHP_MSSQL/include/freetds
36    else
37      AC_MSG_ERROR(Directory $PHP_MSSQL is not a FreeTDS installation directory)
38    fi
39  fi
40
41  if test ! -r "$FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
42     AC_MSG_ERROR(Could not find $FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
43  fi
44
45  PHP_ADD_INCLUDE($FREETDS_INCLUDE_DIR)
46  PHP_ADD_LIBRARY_WITH_PATH(sybdb, $FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, MSSQL_SHARED_LIBADD)
47
48  PHP_NEW_EXTENSION(mssql, php_mssql.c, $ext_shared)
49  AC_CHECK_LIB(dnet_stub, dnet_addr,
50     [ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,MSSQL_SHARED_LIBADD)
51        AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
52     ])
53  AC_DEFINE(HAVE_MSSQL,1,[ ])
54  AC_DEFINE(HAVE_FREETDS,1,[ ])
55  PHP_SUBST(MSSQL_SHARED_LIBADD)
56fi
57