1dnl config.m4 for extension pdo_oci 2dnl vim:et:sw=2:ts=2: 3 4if test -z "$SED"; then 5 PHP_PDO_OCI_SED="sed"; 6else 7 PHP_PDO_OCI_SED="$SED"; 8fi 9 10PHP_PDO_OCI_TAIL1=`echo a | tail -n1 2>/dev/null` 11if test "$PHP_PDO_OCI_TAIL1" = "a"; then 12 PHP_PDO_OCI_TAIL1="tail -n1" 13else 14 PHP_PDO_OCI_TAIL1="tail -1" 15fi 16 17AC_DEFUN([AC_PDO_OCI_VERSION],[ 18 AC_MSG_CHECKING([Oracle version]) 19 PDO_OCI_LCS_BASE=$PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME 20 PDO_OCI_LCS=`ls $PDO_OCI_LCS_BASE.*.1 2> /dev/null | $PHP_PDO_OCI_TAIL1` # Oracle 10g, 11g, 12c etc 21 if test -f "$PDO_OCI_LCS"; then 22 dnl Oracle 10g, 11g 12c etc. The x.2 version libraries are named x.1 for drop in compatibility 23 PDO_OCI_VERSION=`echo $PDO_OCI_LCS | $PHP_PDO_OCI_SED -e 's/.*\.\(.*\)\.1$/\1.1/'` 24 elif test -f $PDO_OCI_LCS_BASE.9.0; then 25 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 26 PDO_OCI_VERSION=9.0 27 else 28 AC_MSG_ERROR(Oracle libclntsh.$SHLIB_SUFFIX_NAME client library not found or its version is lower than 9) 29 fi 30 AC_MSG_RESULT($PDO_OCI_VERSION) 31]) 32 33AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[ 34 AC_CHECK_SIZEOF(long int, 4) 35 AC_MSG_CHECKING([if we're on a 64-bit platform]) 36 if test "$ac_cv_sizeof_long_int" = "4" ; then 37 AC_MSG_RESULT([no]) 38 TMP_PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32" 39 else 40 AC_MSG_RESULT([yes]) 41 TMP_PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib" 42 fi 43 44 AC_MSG_CHECKING([OCI8 libraries dir]) 45 if test -d "$PDO_OCI_DIR/lib" && test ! -d "$PDO_OCI_DIR/lib32"; then 46 PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib" 47 elif test ! -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then 48 PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32" 49 elif test -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then 50 PDO_OCI_LIB_DIR=$TMP_PDO_OCI_LIB_DIR 51 else 52 AC_MSG_ERROR([Oracle required OCI8 libraries not found]) 53 fi 54 AC_MSG_RESULT($PDO_OCI_LIB_DIR) 55]) 56 57PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO, 58[ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to [$]ORACLE_HOME. 59 Use --with-pdo-oci=instantclient,/path/to/instant/client/lib 60 for an Oracle Instant Client installation.]) 61 62if test "$PHP_PDO_OCI" != "no"; then 63 64 if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then 65 AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.]) 66 fi 67 68 AC_MSG_CHECKING([Oracle Install-Dir]) 69 if test "$PHP_PDO_OCI" = "yes" || test -z "$PHP_PDO_OCI"; then 70 PDO_OCI_DIR=$ORACLE_HOME 71 else 72 PDO_OCI_DIR=$PHP_PDO_OCI 73 fi 74 AC_MSG_RESULT($PHP_PDO_OCI) 75 76 AC_MSG_CHECKING([if that is sane]) 77 if test -z "$PDO_OCI_DIR"; then 78 AC_MSG_ERROR([You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.]) 79 else 80 AC_MSG_RESULT([yes]) 81 fi 82 83 if test "instantclient" = "`echo $PDO_OCI_DIR | cut -d, -f1`" ; then 84 AC_CHECK_SIZEOF(long int, 4) 85 if test "$ac_cv_sizeof_long_int" = "4" ; then 86 PDO_OCI_CLIENT_DIR="client" 87 else 88 PDO_OCI_CLIENT_DIR="client64" 89 fi 90 PDO_OCI_LIB_DIR="`echo $PDO_OCI_DIR | cut -d, -f2`" 91 AC_PDO_OCI_VERSION($PDO_OCI_LIB_DIR) 92 93 AC_MSG_CHECKING([for oci.h]) 94 dnl Header directory for Instant Client SDK RPM install 95 OCISDKRPMINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib/oracle/\(.*\)/\('${PDO_OCI_CLIENT_DIR}'\)/lib[/]*$!\1/include/oracle/\2/\3!'` 96 97 dnl Header directory for manual installation 98 OCISDKMANINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib[/]*$!\1/include!'` 99 100 dnl Header directory for Instant Client SDK zip file install 101 OCISDKZIPINC=$PDO_OCI_LIB_DIR/sdk/include 102 103 104 if test -f "$OCISDKRPMINC/oci.h" ; then 105 PHP_ADD_INCLUDE($OCISDKRPMINC) 106 AC_MSG_RESULT($OCISDKRPMINC) 107 elif test -f "$OCISDKMANINC/oci.h" ; then 108 PHP_ADD_INCLUDE($OCISDKMANINC) 109 AC_MSG_RESULT($OCISDKMANINC) 110 elif test -f "$OCISDKZIPINC/oci.h" ; then 111 PHP_ADD_INCLUDE($OCISDKZIPINC) 112 AC_MSG_RESULT($OCISDKZIPINC) 113 else 114 AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your Instant Client install]) 115 fi 116 else 117 AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR) 118 119 if test -d "$PDO_OCI_DIR/rdbms/public"; then 120 PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public) 121 PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/public" 122 fi 123 if test -d "$PDO_OCI_DIR/rdbms/demo"; then 124 PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/demo) 125 PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/demo" 126 fi 127 if test -d "$PDO_OCI_DIR/network/public"; then 128 PHP_ADD_INCLUDE($PDO_OCI_DIR/network/public) 129 PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/network/public" 130 fi 131 if test -d "$PDO_OCI_DIR/plsql/public"; then 132 PHP_ADD_INCLUDE($PDO_OCI_DIR/plsql/public) 133 PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/plsql/public" 134 fi 135 if test -d "$PDO_OCI_DIR/include"; then 136 PHP_ADD_INCLUDE($PDO_OCI_DIR/include) 137 PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/include" 138 fi 139 140 if test -f "$PDO_OCI_LIB_DIR/sysliblist"; then 141 PHP_EVAL_LIBLINE(`cat $PDO_OCI_LIB_DIR/sysliblist`, PDO_OCI_SYSLIB) 142 elif test -f "$PDO_OCI_DIR/rdbms/lib/sysliblist"; then 143 PHP_EVAL_LIBLINE(`cat $PDO_OCI_DIR/rdbms/lib/sysliblist`, PDO_OCI_SYSLIB) 144 fi 145 AC_PDO_OCI_VERSION($PDO_OCI_LIB_DIR) 146 fi 147 148 case $PDO_OCI_VERSION in 149 7.3|8.0|8.1) 150 AC_MSG_ERROR([Oracle client libraries < 9 are not supported]) 151 ;; 152 esac 153 154 PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD) 155 PHP_ADD_LIBPATH($PDO_OCI_LIB_DIR, PDO_OCI_SHARED_LIBADD) 156 157 PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate, 158 [ 159 AC_DEFINE(HAVE_OCIENVCREATE,1,[ ]) 160 ], [], [ 161 -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD 162 ]) 163 164 PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate, 165 [ 166 AC_DEFINE(HAVE_OCIENVNLSCREATE,1,[ ]) 167 ], [], [ 168 -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD 169 ]) 170 171 dnl 172 dnl Check if we need to add -locijdbc8 173 dnl 174 PHP_CHECK_LIBRARY(clntsh, OCILobIsTemporary, 175 [ 176 AC_DEFINE(HAVE_OCILOBISTEMPORARY,1,[ ]) 177 ], [ 178 PHP_CHECK_LIBRARY(ocijdbc8, OCILobIsTemporary, 179 [ 180 PHP_ADD_LIBRARY(ocijdbc8, 1, PDO_OCI_SHARED_LIBADD) 181 AC_DEFINE(HAVE_OCILOBISTEMPORARY,1,[ ]) 182 ], [], [ 183 -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD 184 ]) 185 ], [ 186 -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD 187 ]) 188 189 dnl 190 dnl Check if we have collections 191 dnl 192 PHP_CHECK_LIBRARY(clntsh, OCICollAssign, 193 [ 194 AC_DEFINE(HAVE_OCICOLLASSIGN,1,[ ]) 195 ], [], [ 196 -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD 197 ]) 198 199 dnl Scrollable cursors? 200 PHP_CHECK_LIBRARY(clntsh, OCIStmtFetch2, 201 [ 202 AC_DEFINE(HAVE_OCISTMTFETCH2,1,[ ]) 203 ], [], [ 204 -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD 205 ]) 206 207 ifdef([PHP_CHECK_PDO_INCLUDES], 208 [ 209 PHP_CHECK_PDO_INCLUDES 210 ],[ 211 AC_MSG_CHECKING([for PDO includes]) 212 if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then 213 pdo_cv_inc_path=$abs_srcdir/ext 214 elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then 215 pdo_cv_inc_path=$abs_srcdir/ext 216 elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then 217 pdo_cv_inc_path=$phpincludedir/ext 218 else 219 AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) 220 fi 221 AC_MSG_RESULT($pdo_cv_inc_path) 222 ]) 223 224 PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_cv_inc_path) 225 226 PHP_SUBST_OLD(PDO_OCI_SHARED_LIBADD) 227 PHP_SUBST_OLD(PDO_OCI_DIR) 228 PHP_SUBST_OLD(PDO_OCI_VERSION) 229 230 ifdef([PHP_ADD_EXTENSION_DEP], 231 [ 232 PHP_ADD_EXTENSION_DEP(pdo_oci, pdo) 233 ]) 234 235 AC_DEFINE_UNQUOTED(PHP_PDO_OCI_CLIENT_VERSION, "$PDO_OCI_VERSION", [ ]) 236fi 237