summaryrefslogtreecommitdiffstats
path: root/php-5.6.31-oci.patch
blob: 4c67b13bc775fc31df99d0e2ab801221b1c4b586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From 27d681435174433c3a9b0b8325361dfa383be0a6 Mon Sep 17 00:00:00 2001
From: Christopher Jones <sixd@php.net>
Date: Tue, 20 Jun 2017 16:00:22 +1000
Subject: [PATCH] PDO_OCI: support IC 12.2 in configure option

---
 NEWS                  |  4 ++++
 ext/pdo_oci/config.m4 | 38 ++++++++++++++++++++++++++------------
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/ext/pdo_oci/config.m4 b/ext/pdo_oci/config.m4
index 34cfb13..7132a40 100755
--- a/ext/pdo_oci/config.m4
+++ b/ext/pdo_oci/config.m4
@@ -2,16 +2,31 @@ 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)
 ])                                                                                                                                                                
@@ -147,12 +162,11 @@ You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_
   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)
+    7.3|8.0|8.1)
+      AC_MSG_ERROR(Unsupported Oracle version $PDO_OCI_VERSION)
       ;;
-
     *)
-      AC_MSG_ERROR(Unsupported Oracle version $PDO_OCI_VERSION)
+      PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
       ;;
   esac
 
-- 
2.1.4