[PHP-DEV] PHP_CHECK_FUNC and shared extension (OCI8)

2003-03-01 Thread Michael Mauch
Hi,

how do I use PHP_CHECK_FUNC to make it work even when the extension is
shared?

In ext/oci8/config.m4, if I use

  PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
  PHP_CHECK_FUNC(OCILobIsTemporary, clntsh, ocijdbc8)

it works when configured --with-oci8, but not with --with-oci8=shared.
With --with-oci8=shared, the test case in configure does not give
-L$OCI8_DIR/lib to gcc, so it cannot work.

My previous approach:

  AC_SEARCH_LIBS(OCILobIsTemporary, ocijdbc8, [
PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
  ], [ ], -lclntsh)
  
suffers from the same problem.

Apparently, I'm something missing here.


FWIW, I append a patch for current 4.3.2-dev, although I have not been
able to test it on anything else then Linux with Oracle 8.1.6. The patch
should not affect those systems that find OCILobIsTemporary with
-lclntsh alone. --with-oci8=shared should be no problem there, although
the configure messages

  checking for OCILobIsTemporary in -lclntsh... no
  checking for __OCILobIsTemporary in -lclntsh... no
  checking for OCILobIsTemporary in -locijdbc8... no
  checking for __OCILobIsTemporary in -locijdbc8... no

are misleading. On Tru64 (where OCILobIsTemporary needs -locijdbc8), it
should work --with-oci8, but still not --with-oci8=shared.

In case somebody wants to test the patch, I put a bzip'ed configure
(built with autoconf 2.13, automake 1.5, libtool 1.4.3) on
http://elmicha.de/tools/configure.bz2.

Prehistory:

http://bugs.php.net/bug.php?id=18640
http://bugs.php.net/bug.php?id=22324
http://groups.google.com/groups?selm=setsixhu9.ln2%40elmicha.33322251-0001.dialin.t-online.de

Regards...
Michael

--- ext/oci8/config.m4.orig Sat Mar  1 13:06:55 2003
+++ ext/oci8/config.m4  Sat Mar  1 13:15:37 2003
@@ -89,12 +89,14 @@
 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)
+
+  dnl Does not work with --with-oci8=shared on those
+  dnl systems (e.g. Tru64) where OCILobIsTemporary is found in
+  dnl libocijdbc8.so.
+  dnl
+  PHP_CHECK_FUNC(OCILobIsTemporary, clntsh, ocijdbc8)
+
   AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
   AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])
 
@@ -107,12 +109,14 @@
 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)
+
+  dnl Does not work with --with-oci8=shared on those
+  dnl systems (e.g. Tru64) where OCILobIsTemporary is found in
+  dnl libocijdbc8.so.
+  dnl
+  PHP_CHECK_FUNC(OCILobIsTemporary, clntsh, ocijdbc9)
+
   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



Re: [PHP-DEV] PHP_CHECK_FUNC and shared extension (OCI8)

2003-03-01 Thread Sascha Schumann
 how do I use PHP_CHECK_FUNC to make it work even when the extension is
 shared?

You can manipulate LDFLAGS directly:

php_save=$LDFLAGS
LDFLAGS=-L$dir $LDFLAGS

.. check ..

LDFLAGS=$php_save

- Sascha

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