Annotation of embedaddon/php/ext/oci8/config.m4, revision 1.1
1.1 ! misho 1: dnl
! 2: dnl $Id: config.m4 309823 2011-03-29 21:37:45Z sixd $
! 3: dnl
! 4:
! 5: if test -z "$SED"; then
! 6: PHP_OCI8_SED="sed";
! 7: else
! 8: PHP_OCI8_SED="$SED";
! 9: fi
! 10:
! 11: AC_DEFUN([PHP_OCI_IF_DEFINED],[
! 12: old_CPPFLAGS=$CPPFLAGS
! 13: CPPFLAGS=$3
! 14: AC_EGREP_CPP(yes,[
! 15: #include <oci.h>
! 16: #if defined($1)
! 17: yes
! 18: #endif
! 19: ],[
! 20: CPPFLAGS=$old_CPPFLAGS
! 21: $2
! 22: ],[
! 23: CPPFLAGS=$old_CPPFLAGS
! 24: ])
! 25: ])
! 26:
! 27: AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
! 28: AC_MSG_CHECKING([ORACLE_HOME library validity])
! 29: if test ! -d "$OCI8_DIR"; then
! 30: AC_MSG_ERROR([${OCI8_DIR} is not a directory])
! 31: fi
! 32: if test -d "$OCI8_DIR/lib" && test ! -d "$OCI8_DIR/lib32"; then
! 33: OCI8_LIB_DIR=lib
! 34: elif test ! -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
! 35: OCI8_LIB_DIR=lib32
! 36: elif test -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
! 37: OCI8_LIB_DIR=$PHP_OCI8_OH_LIBDIR
! 38: else
! 39: dnl This isn't an ORACLE_HOME. Try heuristic examination of the dir to help the user
! 40: if test -f "$OCI8_DIR/libociei.$SHLIB_SUFFIX_NAME"; then
! 41: AC_MSG_ERROR([Expected an ORACLE_HOME top level directory but ${OCI8_DIR} appears to be an Instant Client directory. Try --with-oci8=instantclient,${OCI8_DIR}])
! 42: else
! 43: AC_MSG_ERROR([Oracle library directory not found in ${OCI8_DIR}])
! 44: fi
! 45: fi
! 46: AC_MSG_RESULT($OCI8_LIB_DIR)
! 47: ])
! 48:
! 49: AC_DEFUN([AC_OCI8IC_VERSION],[
! 50: AC_MSG_CHECKING([Oracle Instant Client library version compatibility])
! 51: OCI8_LCS_BASE=$PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME
! 52: OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc
! 53: OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | tail -1`
! 54: if test -f "$OCI8_NNZ" && test -f "$OCI8_LCS"; then
! 55: if test ! -f "$OCI8_LCS_BASE"; then
! 56: AC_MSG_ERROR([Link from $OCI8_LCS_BASE to $OCI8_LCS_BASE.*.1 not found])
! 57: fi
! 58: OCI8_ORACLE_VERSION=`echo $OCI8_LCS | $PHP_OCI8_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
! 59: else
! 60: AC_MSG_ERROR([Oracle Instant Client libraries libnnz.$SHLIB_SUFFIX_NAME and libclntsh.$SHLIB_SUFFIX_NAME not found])
! 61: fi
! 62: AC_MSG_RESULT([$OCI8_ORACLE_VERSION])
! 63: ])
! 64:
! 65: AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
! 66: AC_MSG_CHECKING([Oracle library version compatibility])
! 67: OCI8_LCS_BASE=$OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME
! 68: OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc
! 69: if test -s "$OCI8_DIR/orainst/unix.rgs"; then
! 70: OCI8_ORACLE_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
! 71: test -z "$OCI8_ORACLE_VERSION" && OCI8_ORACLE_VERSION=7.3
! 72: elif test -f "$OCI8_LCS"; then
! 73: dnl Oracle 10g, 11g etc. The x.2 version libraries are named x.1 for drop in compatibility
! 74: OCI8_ORACLE_VERSION=`echo $OCI8_LCS | $PHP_OCI8_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
! 75: elif test -f $OCI8_LCS_BASE.9.0; then
! 76: 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
! 77: OCI8_ORACLE_VERSION=9.0
! 78: elif test -f $OCI8_LCS_BASE.8.0; then
! 79: OCI8_ORACLE_VERSION=8.1
! 80: elif test -f $OCI8_LCS_BASE.1.0; then
! 81: OCI8_ORACLE_VERSION=8.0
! 82: elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then
! 83: if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then
! 84: OCI8_ORACLE_VERSION=8.0
! 85: else
! 86: OCI8_ORACLE_VERSION=8.1
! 87: fi
! 88: else
! 89: AC_MSG_ERROR(Oracle libclntsh.$SHLIB_SUFFIX_NAME client library not found)
! 90: fi
! 91: AC_MSG_RESULT($OCI8_ORACLE_VERSION)
! 92: ])
! 93:
! 94:
! 95: dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib
! 96: dnl or
! 97: dnl --with-oci8=shared,/path/to/oracle/home
! 98: PHP_ARG_WITH(oci8, for Oracle Database OCI8 support,
! 99: [ --with-oci8[=DIR] Include Oracle Database OCI8 support. DIR defaults to \$ORACLE_HOME.
! 100: Use --with-oci8=instantclient,/path/to/instant/client/lib
! 101: to use an Oracle Instant Client installation])
! 102:
! 103: if test "$PHP_OCI8" != "no"; then
! 104:
! 105: if test -z "$PHP_OCI8"; then
! 106: dnl --with-oci8=$ORACLE_HOME where ORACLE_HOME isn't set (or is mistyped) will match this case
! 107: AC_MSG_ERROR([Empty parameter value passed to --with-oci8])
! 108: fi
! 109:
! 110: dnl Check PHP version is compatible with this extension
! 111:
! 112: AC_MSG_CHECKING([PHP version])
! 113:
! 114: tmp_version=$PHP_VERSION
! 115: if test -z "$tmp_version"; then
! 116: if test -z "$PHP_CONFIG"; then
! 117: AC_MSG_ERROR([php-config not found])
! 118: fi
! 119: php_version=`$PHP_CONFIG --version 2>/dev/null|head -n 1|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
! 120: else
! 121: php_version=`echo "$tmp_version"|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
! 122: fi
! 123:
! 124: if test -z "$php_version"; then
! 125: AC_MSG_ERROR([failed to detect PHP version, please report])
! 126: fi
! 127:
! 128: ac_IFS=$IFS
! 129: IFS="."
! 130: set $php_version
! 131: IFS=$ac_IFS
! 132: oci8_php_version=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
! 133:
! 134: if test "$oci8_php_version" -lt "4003009"; then
! 135: AC_MSG_ERROR([You need at least PHP 4.3.9 to be able to use this version of OCI8. PHP $php_version found])
! 136: elif test "$oci8_php_version" -ge "6000000"; then
! 137: AC_MSG_ERROR([This version of OCI8 is not compatible with PHP 6 or higher])
! 138: else
! 139: AC_MSG_RESULT([$php_version, ok])
! 140: fi
! 141:
! 142: dnl Set some port specific directory components for use later
! 143:
! 144: AC_CHECK_SIZEOF(long int, 4)
! 145: AC_MSG_CHECKING([checking if we're on a 64-bit platform])
! 146: if test "$ac_cv_sizeof_long_int" = "4"; then
! 147: AC_MSG_RESULT([no])
! 148: PHP_OCI8_OH_LIBDIR=lib32
! 149: PHP_OCI8_IC_LIBDIR_SUFFIX=""
! 150: else
! 151: AC_MSG_RESULT([yes])
! 152: PHP_OCI8_OH_LIBDIR=lib
! 153: PHP_OCI8_IC_LIBDIR_SUFFIX=64
! 154: fi
! 155:
! 156: dnl Determine if the user wants to use Oracle Instant Client libraries
! 157:
! 158: PHP_OCI8_INSTANT_CLIENT="no"
! 159:
! 160: dnl PECL Bug 14268 (Allow "pecl install oci8" command to "autodetect"
! 161: dnl an Instant Client RPM install). This also has a benefit for non
! 162: dnl "pecl install" builds: if the user does --with-oci8 or
! 163: dnl --with-oci8=shared but the ORACLE_HOME environment variable is not
! 164: dnl actually set, the install tries to locate the Instant Client RPM
! 165: if test "$PHP_OCI8" = "yes" && test -z "$ORACLE_HOME"; then
! 166: AC_MSG_WARN([OCI8 extension: ORACLE_HOME is not set, looking for default Oracle Instant Client instead])
! 167: PHP_OCI8=instantclient
! 168: fi
! 169:
! 170: if test "`echo $PHP_OCI8`" = "instantclient"; then
! 171: PHP_OCI8_INSTANT_CLIENT="yes"
! 172: elif test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
! 173: PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
! 174: PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`"
! 175: if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
! 176: PHP_OCI8_INSTANT_CLIENT="yes"
! 177: fi
! 178: if test -z "$PHP_OCI8"; then
! 179: PHP_OCI8=yes
! 180: fi
! 181: elif test "`echo $PHP_OCI8 | cut -d, -f1`" = "instantclient"; then
! 182: PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f2`"
! 183: PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f3,4`"
! 184: if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
! 185: PHP_OCI8_INSTANT_CLIENT="yes"
! 186: fi
! 187: if test -z "$PHP_OCI8"; then
! 188: PHP_OCI8=yes
! 189: fi
! 190: fi
! 191:
! 192: if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
! 193: dnl ***************************************
! 194: dnl Branch for using an ORACLE_HOME install
! 195: dnl ***************************************
! 196:
! 197: AC_MSG_CHECKING([Oracle ORACLE_HOME install directory])
! 198:
! 199: if test "$PHP_OCI8" = "yes"; then
! 200: OCI8_DIR=$ORACLE_HOME
! 201: else
! 202: OCI8_DIR=$PHP_OCI8
! 203: fi
! 204: AC_MSG_RESULT($OCI8_DIR)
! 205:
! 206: AC_OCI8_CHECK_LIB_DIR($OCI8_DIR)
! 207:
! 208: if test -d "$OCI8_DIR/rdbms/public"; then
! 209: PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public)
! 210: OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/public"
! 211: fi
! 212: if test -d "$OCI8_DIR/rdbms/demo"; then
! 213: PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo)
! 214: OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/demo"
! 215: fi
! 216: if test -d "$OCI8_DIR/network/public"; then
! 217: PHP_ADD_INCLUDE($OCI8_DIR/network/public)
! 218: OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/network/public"
! 219: fi
! 220: if test -d "$OCI8_DIR/plsql/public"; then
! 221: PHP_ADD_INCLUDE($OCI8_DIR/plsql/public)
! 222: OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/plsql/public"
! 223: fi
! 224:
! 225: if test -f "$OCI8_DIR/$OCI8_LIB_DIR/sysliblist"; then
! 226: PHP_EVAL_LIBLINE(`cat $OCI8_DIR/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB)
! 227: elif test -f "$OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist"; then
! 228: PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB)
! 229: fi
! 230:
! 231: AC_OCI8_ORACLE_VERSION($OCI8_DIR)
! 232:
! 233: case $OCI8_ORACLE_VERSION in
! 234: 7.3|8.0|8.1)
! 235: AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported])
! 236: ;;
! 237:
! 238: 9.0)
! 239: PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
! 240: [
! 241: OCI8_ORACLE_VERSION=9.2
! 242: ],
! 243: [
! 244: AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported])
! 245: ], [
! 246: -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
! 247: ])
! 248: ;;
! 249:
! 250: *)
! 251: AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
! 252: ;;
! 253: esac
! 254:
! 255: PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
! 256: PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
! 257: PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
! 258: AC_DEFINE(HAVE_OCI8,1,[ ])
! 259:
! 260: PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
! 261: PHP_SUBST_OLD(OCI8_DIR)
! 262: PHP_SUBST_OLD(OCI8_ORACLE_VERSION)
! 263:
! 264: dnl Fix Bug #46623
! 265: AC_DEFINE_UNQUOTED(PHP_OCI8_DEF_DIR, "$OCI8_DIR", [ ])
! 266: AC_DEFINE_UNQUOTED(PHP_OCI8_DEF_SHARED_LIBADD, "$OCI8_SHARED_LIBADD", [ ])
! 267:
! 268: else
! 269: dnl ***************************************************
! 270: dnl Branch for using an Oracle Instant Client directory
! 271: dnl ***************************************************
! 272:
! 273: AC_MSG_CHECKING([Oracle Instant Client directory])
! 274:
! 275: if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
! 276: dnl Find the directory if user specified "instantclient" but did not
! 277: dnl give a dir. Generally the Instant Client can be anywhere so the
! 278: dnl user must pass in the library directory. But on Linux we default
! 279: dnl to the most recent version in /usr/lib which is where the Oracle
! 280: dnl Instant Client RPM gets installed.
! 281: PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | tail -1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'`
! 282: if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
! 283: AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib libraries not found. Try --with-oci8=instantclient,DIR])
! 284: fi
! 285: fi
! 286: AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT)
! 287:
! 288: OCI8_DIR=$PHP_OCI8_INSTANT_CLIENT
! 289:
! 290: AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
! 291:
! 292: dnl Header directory for Instant Client SDK RPM install
! 293: OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
! 294:
! 295: dnl Header directory for Instant Client SDK zip file install
! 296: OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include
! 297:
! 298: dnl Header directory for manual installation
! 299: OCISDKMANINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!\(.*\)/lib[/]*$!\1/include!'`
! 300:
! 301: if test -f "$OCISDKRPMINC/oci.h"; then
! 302: AC_MSG_RESULT($OCISDKRPMINC)
! 303: PHP_ADD_INCLUDE($OCISDKRPMINC)
! 304: OCI8INCDIR=$OCISDKRPMINC
! 305: elif test -f "$OCISDKZIPINC/oci.h"; then
! 306: AC_MSG_RESULT($OCISDKZIPINC)
! 307: PHP_ADD_INCLUDE($OCISDKZIPINC)
! 308: OCI8INCDIR=$OCISDKZIPINC
! 309: elif test -f "$OCISDKMANINC/oci.h"; then
! 310: AC_MSG_RESULT($OCISDKMANINC)
! 311: PHP_ADD_INCLUDE($OCISDKMANINC)
! 312: OCI8INCDIR=$OCISDKMANINC
! 313: else
! 314: AC_MSG_ERROR([Oracle Instant Client SDK header files not found])
! 315: fi
! 316:
! 317: OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI8_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'`
! 318: if test -f "$OCISYSLIBLIST"; then
! 319: PHP_EVAL_LIBLINE(`cat $OCISYSLIBLIST`, OCI8_SYSLIB)
! 320: fi
! 321:
! 322: AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
! 323: PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
! 324: PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
! 325:
! 326: AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
! 327: AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
! 328:
! 329: PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
! 330: AC_DEFINE(HAVE_OCI8,1,[ ])
! 331:
! 332: PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
! 333: PHP_SUBST_OLD(OCI8_DIR)
! 334: PHP_SUBST_OLD(OCI8_ORACLE_VERSION)
! 335:
! 336: fi
! 337: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>