Skip to content

Commit

Permalink
Fixed Bug #74537 (Align --with-pdo-oci configure option with --with-o…
Browse files Browse the repository at this point in the history
…ci8 syntax)
  • Loading branch information
cjbj committed Jun 20, 2017
1 parent 1968cd1 commit 52e5406
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 59 deletions.
8 changes: 6 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ PHP NEWS
. Use TLS_ANY for default ssl:// and tls:// negotiation.
(Niklas Keller, me at kelunik dot com)

- Standard
- PDO_OCI:
. Fixed Bug #74537 (Align --with-pdo-oci configure option with --with-oci8 syntax).
(Tianfang Yang)

- Standard:
. Compatibility with libargon2 versions 20161029 and 20160821.
(charlesportwoodii at erianna dot com)

- Streams
- Streams:
. Default ssl/single_dh_use and ssl/honor_cipher_order to true.
(me at kelunik dot com)

Expand Down
4 changes: 4 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
. mb_convert_encoding() accepts array parameter. Only value encodings
are converted recursively.

- PDO_OCI:
. The '--with-pdo-oci' configure syntax no longer needs the vesion number of the
Oracle Instant Client.

- pdo_sqlite
. Use sqlite3_prepare_v2() and sqlite3_close_v2() functions instead of their
legacy counterparts.
Expand Down
111 changes: 54 additions & 57 deletions ext/pdo_oci/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@ dnl $Id$
dnl config.m4 for extension pdo_oci
dnl vim:et:sw=2:ts=2:

SUPPORTED_LIB_VERS="9.0 10.1 11.1 12.1" # The lib vers are not bumped when the DB version is bumped
if test -z "$SED"; then
PHP_PDO_OCI_SED="sed";
else
PHP_PDO_OCI_SED="$SED";
fi

PHP_PDO_OCI_TAIL1=`echo a | tail -n1 2>/dev/null`
if test "$PHP_PDO_OCI_TAIL1" = "a"; then
PHP_PDO_OCI_TAIL1="tail -n1"
else
PHP_PDO_OCI_TAIL1="tail -1"
fi

AC_DEFUN([AC_PDO_OCI_VERSION],[
AC_MSG_CHECKING([Oracle version])
for OCI_VER in $SUPPORTED_LIB_VERS; do
if test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.$OCI_VER; then
PDO_OCI_VERSION="$OCI_VER"
fi
done
if test -z "$PDO_OCI_VERSION"; then
AC_MSG_ERROR([Oracle required OCI8 libraries not found under $PDO_OCI_DIR])
PDO_OCI_LCS_BASE=$PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME
PDO_OCI_LCS=`ls $PDO_OCI_LCS_BASE.*.1 2> /dev/null | $PHP_PDO_OCI_TAIL1` # Oracle 10g, 11g, 12c etc
if test -f "$PDO_OCI_LCS"; then
dnl Oracle 10g, 11g 12c etc. The x.2 version libraries are named x.1 for drop in compatibility
PDO_OCI_VERSION=`echo $PDO_OCI_LCS | $PHP_PDO_OCI_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
elif test -f $PDO_OCI_LCS_BASE.9.0; then
dnl There is no case for Oracle 9.2. Oracle 9.2 libraries have a 9.0 suffix for drop-in compatibility with Oracle 9.0
PDO_OCI_VERSION=9.0
else
AC_MSG_ERROR(Oracle libclntsh.$SHLIB_SUFFIX_NAME client library not found or its version is lower than 9)
fi
AC_MSG_RESULT($PDO_OCI_VERSION)
])
])

AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[
AC_CHECK_SIZEOF(long int, 4)
Expand All @@ -41,13 +56,9 @@ AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[
])

PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO,
[ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to \$ORACLE_HOME.
Use --with-pdo-oci=instantclient,prefix,version
for an Oracle Instant Client SDK.
For example on Linux with 11.2 RPMs use:
--with-pdo-oci=instantclient,/usr,11.2
With 10.2 RPMs use:
--with-pdo-oci=instantclient,/usr,10.2.0.4])
[ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to [$]ORACLE_HOME.
Use --with-pdo-oci=instantclient,/path/to/instant/client/lib
for an Oracle Instant Client installation.])

if test "$PHP_PDO_OCI" != "no"; then

Expand All @@ -65,9 +76,7 @@ if test "$PHP_PDO_OCI" != "no"; then

AC_MSG_CHECKING([if that is sane])
if test -z "$PDO_OCI_DIR"; then
AC_MSG_ERROR([
You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.
])
AC_MSG_ERROR([You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.])
else
AC_MSG_RESULT([yes])
fi
Expand All @@ -79,41 +88,32 @@ You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_
else
PDO_OCI_CLIENT_DIR="client64"
fi
PDO_OCI_IC_PREFIX="`echo $PDO_OCI_DIR | cut -d, -f2`"
PDO_OCI_IC_VERS="`echo $PDO_OCI_DIR | cut -d, -f3`"
if test -n "$PDO_OCI_IC_VERS"; then
PDO_OCI_IC_MAJ_VER="`echo $PDO_OCI_IC_VERS | cut -d. -f1`"
if test "$PDO_OCI_IC_MAJ_VER" -ge 11; then
# From 11.1.0.7 the RPM path only has an X.Y component
PDO_OCI_IC_VERS="`echo $PDO_OCI_IC_VERS | cut -d. -f1-2`"
fi
fi
PDO_OCI_LIB_DIR="`echo $PDO_OCI_DIR | cut -d, -f2`"
AC_PDO_OCI_VERSION($PDO_OCI_LIB_DIR)

AC_MSG_CHECKING([for oci.h])
if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/oci.h ; then
PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR)
AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR)
elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include/oci.h ; then
PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include)
AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include)
elif test -f $PDO_OCI_IC_PREFIX/sdk/include/oci.h ; then
PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/sdk/include)
AC_MSG_RESULT($PDO_OCI_IC_PREFIX/sdk/include)
elif test -f $PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include/oci.h ; then
PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include)
AC_MSG_RESULT($PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include)
dnl Header directory for Instant Client SDK RPM install
OCISDKRPMINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib/oracle/\(.*\)/\('${PDO_OCI_CLIENT_DIR}'\)/lib[/]*$!\1/include/oracle/\2/\3!'`

dnl Header directory for manual installation
OCISDKMANINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib[/]*$!\1/include!'`

dnl Header directory for Instant Client SDK zip file install
OCISDKZIPINC=$PDO_OCI_LIB_DIR/sdk/include


if test -f "$OCISDKRPMINC/oci.h" ; then
PHP_ADD_INCLUDE($OCISDKRPMINC)
AC_MSG_RESULT($OCISDKRPMINC)
elif test -f "$OCISDKMANINC/oci.h" ; then
PHP_ADD_INCLUDE($OCISDKMANINC)
AC_MSG_RESULT($OCISDKMANINC)
elif test -f "$OCISDKZIPINC/oci.h" ; then
PHP_ADD_INCLUDE($OCISDKZIPINC)
AC_MSG_RESULT($OCISDKZIPINC)
else
AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your Instant Client install])
fi
if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/lib"
elif test -f "$PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/lib"
elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.$SHLIB_SUFFIX_NAME" ; then
PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX"
else
AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your Instant Client install])
fi
PDO_OCI_VERSION="`echo $PDO_OCI_IC_VERS | cut -d. -f1-2`"
else
AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR)

Expand Down Expand Up @@ -143,19 +143,16 @@ You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_
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_PDO_OCI_VERSION($PDO_OCI_DIR)
AC_PDO_OCI_VERSION($PDO_OCI_LIB_DIR)
fi

case $PDO_OCI_VERSION in
9.0|10.1|10.2|11.1|11.2|12.1)
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
;;

*)
AC_MSG_ERROR(Unsupported Oracle version $PDO_OCI_VERSION)
7.3|8.0|8.1)
AC_MSG_ERROR([Oracle client libraries < 9 are not supported])
;;
esac

PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($PDO_OCI_LIB_DIR, PDO_OCI_SHARED_LIBADD)

PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate,
Expand Down

0 comments on commit 52e5406

Please sign in to comment.