Allow PDO OCI to build under unix.

Don't build by default under win32.
This commit is contained in:
Wez Furlong 2004-05-17 18:17:39 +00:00
parent dd84731577
commit cf4127b6b9
3 changed files with 80 additions and 112 deletions

View File

@ -1,151 +1,124 @@
dnl
dnl $Id$
dnl
dnl This file is more or less a straight copy from oci8; it won't work with pdo_oci yet!
AC_DEFUN(PHP_OCI_IF_DEFINED,[
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=$3
AC_EGREP_CPP(yes,[
#include <oci.h>
#if defined($1)
yes
#endif
],[
CPPFLAGS=$old_CPPFLAGS
$2
],[
CPPFLAGS=$old_CPPFLAGS
])
])
AC_DEFUN(AC_OCI_VERSION,[
AC_DEFUN(AC_PDO_OCI_VERSION,[
AC_MSG_CHECKING([Oracle version])
if test -s "$OCI_DIR/orainst/unix.rgs"; then
OCI_VERSION=`grep '"ocommon"' $OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$OCI_VERSION" && OCI_VERSION=7.3
elif test -f $OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
OCI_VERSION=10.1
if test -s "$PDO_OCI_DIR/orainst/unix.rgs"; then
PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
PDO_OCI_VERSION=10.1
elif test -f $OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
OCI_VERSION=9.0
elif test -f $OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
OCI_VERSION=8.1
elif test -f $OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
OCI_VERSION=8.0
elif test -f $OCI_DIR/lib/libclntsh.a; then
if test -f $OCI_DIR/lib/libcore4.a; then
OCI_VERSION=8.0
PDO_OCI_VERSION=9.0
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
PDO_OCI_VERSION=8.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
PDO_OCI_VERSION=8.0
elif test -f $PDO_OCI_DIR/lib/libclntsh.a; then
if test -f $PDO_OCI_DIR/lib/libcore4.a; then
PDO_OCI_VERSION=8.0
else
OCI_VERSION=8.1
PDO_OCI_VERSION=8.1
fi
else
AC_MSG_ERROR(Oracle-OCI needed libraries not found)
AC_MSG_ERROR(Oracle-OCI needed libraries not found under $PDO_OCI_DIR)
fi
AC_MSG_RESULT($OCI_VERSION)
AC_MSG_RESULT($PDO_OCI_VERSION)
])
PHP_ARG_WITH(oci, for Oracle-OCI support,
[ --with-oci[=DIR] Include Oracle-oci support. Default DIR is ORACLE_HOME.])
PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO,
[ --with-pdo-oci[=DIR] Include Oracle-oci support. Default DIR is ORACLE_HOME.])
if test "$PHP_OCI" != "no"; then
if test "$PDO_OCI" != "no"; then
AC_MSG_CHECKING([Oracle Install-Dir])
if test "$PHP_OCI" = "yes"; then
OCI_DIR=$ORACLE_HOME
if test "$PDO_OCI" = "yes" -o -z "$PDO_OCI"; then
PDO_OCI_DIR=$ORACLE_HOME
else
OCI_DIR=$PHP_OCI
PDO_OCI_DIR=$PDO_OCI
fi
AC_MSG_RESULT($OCI_DIR)
AC_MSG_RESULT($PDO_OCI_DIR :$PDO_OCI:)
if test -d "$OCI_DIR/rdbms/public"; then
PHP_ADD_INCLUDE($OCI_DIR/rdbms/public)
OCI_INCLUDES="$OCI_INCLUDES -I$OCI_DIR/rdbms/public"
if test -d "$PDO_OCI_DIR/rdbms/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public)
PDO_OCI_INCLUDES="$OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/public"
fi
if test -d "$OCI_DIR/rdbms/demo"; then
PHP_ADD_INCLUDE($OCI_DIR/rdbms/demo)
OCI_INCLUDES="$OCI_INCLUDES -I$OCI_DIR/rdbms/demo"
if test -d "$PDO_OCI_DIR/rdbms/demo"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/demo)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/demo"
fi
if test -d "$OCI_DIR/network/public"; then
PHP_ADD_INCLUDE($OCI_DIR/network/public)
OCI_INCLUDES="$OCI_INCLUDES -I$OCI_DIR/network/public"
if test -d "$PDO_OCI_DIR/network/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/network/public)
OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/network/public"
fi
if test -d "$OCI_DIR/plsql/public"; then
PHP_ADD_INCLUDE($OCI_DIR/plsql/public)
OCI_INCLUDES="$OCI_INCLUDES -I$OCI_DIR/plsql/public"
if test -d "$PDO_OCI_DIR/plsql/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/plsql/public)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/plsql/public"
fi
if test -f "$OCI_DIR/lib/sysliblist"; then
PHP_EVAL_LIBLINE(`cat $OCI_DIR/lib/sysliblist`, OCI_SYSLIB)
elif test -f "$OCI_DIR/rdbms/lib/sysliblist"; then
PHP_EVAL_LIBLINE(`cat $OCI_DIR/rdbms/lib/sysliblist`, OCI_SYSLIB)
if test -f "$PDO_OCI_DIR/lib/sysliblist"; then
PHP_EVAL_LIBLINE(`cat $PDO_OCI_DIR/lib/sysliblist`, PDO_OCI_SYSLIB)
elif test -f "$PDO_OCI_DIR/rdbms/lib/sysliblist"; then
PHP_EVAL_LIBLINE(`cat $PDO_OCI_DIR/rdbms/lib/sysliblist`, PDO_OCI_SYSLIB)
fi
AC_OCI_VERSION($OCI_DIR)
case $OCI_VERSION in
AC_PDO_OCI_VERSION($PDO_OCI_DIR)
case $PDO_OCI_VERSION in
8.0)
PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(core4, "", OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(psa, "", OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $OCI_DIR/lib, OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(core4, "", PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(psa, "", PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $PDO_OCI_DIR/lib, PDO_OCI_SHARED_LIBADD)
;;
8.1)
PHP_ADD_LIBRARY(clntsh, 1, OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($OCI_DIR/lib, OCI_SHARED_LIBADD)
dnl
dnl OCI_ATTR_STATEMENT is not available in all 8.1.x versions
dnl
PHP_OCI_IF_DEFINED(OCI_ATTR_STATEMENT, [AC_DEFINE(HAVE_OCI_ATTR_STATEMENT,1,[ ])], $OCI_INCLUDES)
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($PDO_OCI_DIR/lib, PDO_OCI_SHARED_LIBADD)
;;
9.0)
PHP_ADD_LIBRARY(clntsh, 1, OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($OCI_DIR/lib, OCI_SHARED_LIBADD)
AC_DEFINE(HAVE_OCI_ATTR_STATEMENT,1,[ ])
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($PDO_OCI_DIR/lib, PDO_OCI_SHARED_LIBADD)
dnl These functions are only available in version >= 9.2
PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
[
PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId,
[
AC_DEFINE(HAVE_OCI_9_2,1,[ ])
OCI_VERSION=9.2
], [], [
-L$OCI_DIR/lib $OCI_SHARED_LIBADD
])
], [], [
-L$OCI_DIR/lib $OCI_SHARED_LIBADD
])
;;
10.1)
PHP_ADD_LIBRARY(clntsh, 1, OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($OCI_DIR/lib, OCI_SHARED_LIBADD)
AC_DEFINE(HAVE_OCI_ATTR_STATEMENT,1,[ ])
AC_DEFINE(HAVE_OCI_9_2,1,[ ])
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($PDO_OCI_DIR/lib, PDO_OCI_SHARED_LIBADD)
;;
*)
AC_MSG_ERROR(Unsupported Oracle version!)
;;
esac
PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate,
[
AC_DEFINE(HAVE_OCIENVCREATE,1,[ ])
], [], [
-L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
])
PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
[
AC_DEFINE(HAVE_OCIENVNLSCREATE,1,[ ])
], [], [
-L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
])
dnl
dnl Check if we need to add -locijdbc8
dnl
PHP_CHECK_LIBRARY(clntsh, OCILobIsTemporary,
[
AC_DEFINE(HAVE_OCI_TEMP_LOB,1,[ ])
AC_DEFINE(HAVE_OCILOBISTEMPORARY,1,[ ])
], [
PHP_CHECK_LIBRARY(ocijdbc8, OCILobIsTemporary,
[
PHP_ADD_LIBRARY(ocijdbc8, 1, OCI_SHARED_LIBADD)
AC_DEFINE(HAVE_OCI_TEMP_LOB,1,[ ])
AC_DEFINE(HAVE_OCILOBISTEMPORARY,1,[ ])
], [], [
-L$OCI_DIR/lib $OCI_SHARED_LIBADD
-L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
])
], [
-L$OCI_DIR/lib $OCI_SHARED_LIBADD
-L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
])
dnl
@ -153,17 +126,17 @@ if test "$PHP_OCI" != "no"; then
dnl
PHP_CHECK_LIBRARY(clntsh, OCICollAssign,
[
AC_DEFINE(PHP_OCI_HAVE_COLLECTIONS,1,[ ])
AC_DEFINE(HAVE_OCICOLLASSIGN,1,[ ])
], [], [
-L$OCI_DIR/lib $OCI_SHARED_LIBADD
-L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
])
PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared)
AC_DEFINE(HAVE_OCI,1,[ ])
PHP_SUBST_OLD(OCI_SHARED_LIBADD)
PHP_SUBST_OLD(OCI_DIR)
PHP_SUBST_OLD(OCI_VERSION)
PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I\$prefix/include/php/ext)
PHP_SUBST_OLD(PDO_OCI_SHARED_LIBADD)
PHP_SUBST_OLD(PDO_OCI_DIR)
PHP_SUBST_OLD(PDO_OCI_VERSION)
fi

View File

@ -1,7 +1,7 @@
// $Id$
// vim:ft=javascript
ARG_WITH("pdo-oci", "Oracle OCI support for PDO", "yes,shared");
ARG_WITH("pdo-oci", "Oracle OCI support for PDO", "no");
if (PHP_PDO_OCI != "no") {
@ -29,11 +29,6 @@ if (PHP_PDO_OCI != "no") {
EXTENSION('pdo_oci', 'pdo_oci.c oci_driver.c oci_statement.c');
ADD_FLAG('CFLAGS_PDO_OCI', "/I ..\\pecl");
AC_DEFINE('HAVE_OCI_TEMP_LOB', 1);
AC_DEFINE('HAVE_OCI', 1);
AC_DEFINE('HAVE_OCI_ATTR_STATEMENT', 1);
AC_DEFINE('PHP_OCI_HAVE_COLLECTIONS', 1);
/* LOCAL HACKS: assume you have OCI 9.2 */
AC_DEFINE('HAVE_OCIENVCREATE', 1);
AC_DEFINE('HAVE_OCIENVNLSCREATE', 1);

View File

@ -301,7 +301,7 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
zend_bool dyn = FALSE;
/* describe the column */
STMT_CALL(OCIParamGet, (S->stmt, OCI_HTYPE_STMT, S->err, &param, colno+1));
STMT_CALL(OCIParamGet, (S->stmt, OCI_HTYPE_STMT, S->err, (dvoid*)&param, colno+1));
/* what type ? */
STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_DATA_TYPE",
@ -359,7 +359,7 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
if (!dyn) {
STMT_CALL(OCIDefineByPos, (S->stmt, &S->cols[colno].def, S->err, colno+1,
S->cols[colno].data, S->cols[colno].datalen, dtype, &S->cols[colno].indicator,
&S->cols[colno].fetched_len, &S->cols[colno].retcode));
&S->cols[colno].fetched_len, &S->cols[colno].retcode, OCI_DEFAULT));
}
return 1;