diff options
author | Wez Furlong <wez@php.net> | 2005-01-12 02:19:30 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-01-12 02:19:30 +0000 |
commit | f9d3469e4f5d8c31519d0829eb39f39dab58a29a (patch) | |
tree | 5ea387d68856fa77347abdb1ca504966eeafdce1 /ext/pdo_odbc | |
parent | c13ec603b824ca67186547174639eca1f3627ce9 (diff) | |
download | php-git-f9d3469e4f5d8c31519d0829eb39f39dab58a29a.tar.gz |
Add configure support for ODBCRouter and generic ODBC libs.
Note that ODBCRouter doesn't directly implement ODBC 3.0, so
using it here won't really work.
Expand the ODBC 3 check to better explain what happened and
how to make progress (e.g.: use an ODBC manager library like
unixODBC).
Diffstat (limited to 'ext/pdo_odbc')
-rwxr-xr-x | ext/pdo_odbc/config.m4 | 35 | ||||
-rwxr-xr-x | ext/pdo_odbc/php_pdo_odbc_int.h | 4 |
2 files changed, 36 insertions, 3 deletions
diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4 index e69a8a6bc7..afa47f866f 100755 --- a/ext/pdo_odbc/config.m4 +++ b/ext/pdo_odbc/config.m4 @@ -1,18 +1,23 @@ dnl $Id$ dnl config.m4 for extension pdo_odbc +dnl vim:et:sw=2:ts=2: AC_DEFUN(PDO_ODBC_HELP_TEXT, [[ --with-pdo-odbc=flavour,dir Add support for "flavour" ODBC drivers, looking for include and lib dirs under "dir" flavour can be one of: - ibm-db2, unixODBC + ibm-db2, unixODBC, ODBCRouter, generic You may omit the ,dir part to use a reasonable default for the flavour you have selected. e.g.: --with-pdo-odbc=unixODBC will check for unixODBC under /usr/local + You may attempt to use an otherwise unsupported driver using + the generic flavour. The syntax for generic ODBC support is: + --with-pdo-odbc=generic,dir,ldflags,cflags + This extension will always be created as a shared extension named pdo_odbc.so ]]) @@ -47,6 +52,18 @@ if test "$PHP_PDO_ODBC" != "no" && test "$PHP_PDO_ODBC" != "yes" ; then pdo_odbc_def_lib=-lodbc ;; + ODBCRouter) + pdo_odbc_def_libdir=/usr/lib + pdo_odbc_def_incdir=/usr/include + pdo_odbc_def_lib=-lodbcsdk + ;; + + generic) + pdo_odbc_def_lib="`echo $withval | cut -d, -f3`" + pdo_odbc_def_cflags="`echo $withval | cut -d, -f4`" + pdo_odbc_flavour="$pdo_odbc_flavour ($pdo_odbc_def_lib)" + ;; + *) AC_MSG_ERROR(Unknown ODBC flavour $pdo_odbc_flavour PDO_ODBC_HELP_TEXT @@ -72,6 +89,7 @@ PDO_ODBC_HELP_TEXT dnl yick time PDO_ODBC_CHECK_HEADER(odbc.h) + PDO_ODBC_CHECK_HEADER(odbcsdk.h) PDO_ODBC_CHECK_HEADER(iodbc.h) PDO_ODBC_CHECK_HEADER(sqlunix.h) PDO_ODBC_CHECK_HEADER(sqltypes.h) @@ -89,13 +107,24 @@ PDO_ODBC_HELP_TEXT PDO_ODBC_CHECK_HEADER(cli0defs.h) PDO_ODBC_CHECK_HEADER(cli0env.h) - PDO_ODBC_INCLUDE="-I$PDO_ODBC_INCDIR -DPDO_ODBC_TYPE=\\\"$pdo_odbc_flavour\\\"" + PDO_ODBC_INCLUDE="$pdo_odbc_def_cflags -I$PDO_ODBC_INCDIR -DPDO_ODBC_TYPE=\\\"$pdo_odbc_flavour\\\"" PDO_ODBC_LFLAGS="-L$PDO_ODBC_LIBDIR" PDO_ODBC_LIBS="$pdo_odbc_def_lib" LDFLAGS="$PDO_ODBC_LFLAGS $PDO_ODBC_LIBS -lm -ldl" + dnl Check for an ODBC 1.0 function to assert that the libraries work + AC_TRY_LINK_FUNC([SQLBindCol],[],[ + AC_MSG_ERROR([[Your ODBC library does not exist]]) + ]) + dnl And now check for an ODBC 3.0 function to assert that they're + dnl *good* libraries. AC_TRY_LINK_FUNC([SQLAllocHandle],[],[ - AC_MSG_ERROR([[Your ODBC libraries either do not exist, or do not appear to be ODBC3 compatible]]) + AC_MSG_ERROR([[ +Your ODBC library does not appear to be ODBC 3 compatible. +You should consider using unixODBC instead, and loading your +libraries as a driver in that environment; it will emulate the +functions required for PDO support. +]]) ]) LDFLAGS=$save_old_LDFLAGS PHP_EVAL_LIBLINE($PDO_ODBC_LIBS $PDO_ODBC_LFLAGS, [PDO_ODBC_SHARED_LIBADD]) diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h index e249be5687..a4d473e3b8 100755 --- a/ext/pdo_odbc/php_pdo_odbc_int.h +++ b/ext/pdo_odbc/php_pdo_odbc_int.h @@ -86,6 +86,10 @@ # include <cli0env.h> #endif +#if HAVE_ODBCSDK_H +# include <odbcsdk.h> +#endif + /* }}} */ /* {{{ Figure out the type for handles */ |