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