Hi,

my older patch for the link problems with OCI8 on Tru64 broke the build
on AIX and maybe other systems, so Jani commented it out. Here comes a
better patch. Instead of just linking to libocijdbc8/9 if it is
available, it tries to find the OCILobIsTemporary function in the normal
libclntsh first, and does nothing if it's there. Only if
OCILobIsTemporary is not in libclntsh, another check is done to search
it in libocijdbc8/9.

I tested it on Linux with Oracle 8.1.6, Tru64 with 8.1.6, 8.1.7 and
9.0.1, and made sure that libocijdb8/9 is linked only when necessary.

The patch is not yet tested on AIX, though. I'll ask the two people who
reported bug #22324 after the patch has been applied (or should I ask
them before the patch is applied, and send them the new configure and
main/php_config.h.in built here?).

Just before posting this, I became aware that at least here (Linux,
Oracle 8.1.6), the line

AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])

results in a core dump at startup, if I use --with-oci8=shared. This is
a separate problem (#22521), it also happens without my patch. Setting
OCI_USE_EMALLOC to 1 in oci8.c doesn't change it.

Regards...
                Michael

Index: ext/oci8/config.m4
===================================================================
RCS file: /repository/php4/ext/oci8/config.m4,v
retrieving revision 1.37.2.3
diff -u -B -b -r1.37.2.3 config.m4
--- ext/oci8/config.m4  25 Feb 2003 04:37:08 -0000      1.37.2.3
+++ ext/oci8/config.m4  3 Mar 2003 20:45:03 -0000
@@ -89,14 +89,20 @@
     8.1)
       PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
 
-dnl This breaks build on some systems (AIX at least).
-dnl   if test -f $OCI8_DIR/lib/libocijdbc8.so ; then
-dnl     PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
-dnl   fi
-
       PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
+
+      php_save="$LDFLAGS"
+      LDFLAGS="-L$OCI8_DIR/lib $LDFLAGS"
+      AC_CHECK_LIB(clntsh, OCILobIsTemporary, [ ], [
+        AC_CHECK_LIB(ocijdbc8, OCILobIsTemporary, [
+          PHP_ADD_LIBRARY_WITH_PATH(ocijdbc8, $OCI8_DIR/lib, OCI8_SHARED_LIBADD)
+        ], [ ])
+      ])
+      LDFLAGS="$php_save"
+
       AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
-      AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])
+
+      dnl AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])
 
       dnl 
       dnl OCI_ATTR_STATEMENT is not available in all 8.1.x versions
@@ -107,12 +113,17 @@
     9.0)
       PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
 
-dnl This breaks build on some systems (AIX at least)
-dnl if test -f $OCI8_DIR/lib/libocijdbc8.so ; then
-dnl   PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
-dnl fi
-
       PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
+
+      php_save="$LDFLAGS"
+      LDFLAGS="-L$OCI8_DIR/lib $LDFLAGS"
+      AC_CHECK_LIB(clntsh, OCILobIsTemporary, [ ], [
+        AC_CHECK_LIB(ocijdbc9, OCILobIsTemporary, [
+          PHP_ADD_LIBRARY_WITH_PATH(ocijdbc9, $OCI8_DIR/lib, OCI8_SHARED_LIBADD)
+        ], [ ])
+      ])
+      LDFLAGS="$php_save"
+
       AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
       AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
       AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to