From:             andreas at conectiva dot com dot br
Operating system: linux
PHP version:      4CVS-2003-06-04 (stable)
PHP Bug Type:     Compile Failure
Bug description:  Can't build with shared ldap support

The configure test for ldap_start_tls_s and other ldap functions fails to
pass along needed ldap libraries:

(...)
configure:41587: checking for ldap_parse_reference
configure:41615: gcc -o conftest -O2 -march=i386 -mcpu=pentiumpro -fPIC 
-L/usr/lib -ldb-4.1 -L/usr/lib/krb5 conftest.c -lcrypt -lpam
 -lgmp -lfreetype -lpng -lz -ljpeg -lz -ldb-4.1 -lgdbm -lcurl -lbz2 -lz
-lssl -lcrypto -lresolv -lm -ldl -lnsl  -lcurl -lz -lssl -lcr
ypto -ldl -lz -lxml2 -lz -lm 1>&5
(...)
configure:41587: checking for ldap_start_tls_s
configure:41615: gcc -o conftest -O2 -march=i386 -mcpu=pentiumpro -fPIC 
-L/usr/lib -ldb-4.1 -L/usr/lib/krb5 conftest.c -lcrypt -lpam
 -lgmp -lfreetype -lpng -lz -ljpeg -lz -ldb-4.1 -lgdbm -lcurl -lbz2 -lz
-lssl -lcrypto -lresolv -lm -ldl -lnsl  -lcurl -lz -lssl -lcr
ypto -ldl -lz -lxml2 -lz -lm 1>&5
(...)

The patch below, against ext/ldap/config.m4, worksaround this problem.
Worked here, but may not be the right way to fix this:
--- php4-STABLE-200306041730/ext/ldap/config.m4.orig    2003-06-04
16:25:11.000000000 -0300
+++ php4-STABLE-200306041730/ext/ldap/config.m4 2003-06-04
16:30:21.000000000 -0300
@@ -110,7 +110,9 @@
 
   dnl Check for 3 arg ldap_set_rebind_proc
   _SAVE_CPPFLAGS=$CPPFLAGS
+  _SAVE_LDFLAGS=$LDFLAGS
   CPPFLAGS="$CPPFLAGS -I$LDAP_INCDIR"
+  LDFLAGS="$LDFLAGS -L$LDAP_LIBDIR $LDAP_SHARED_LIBADD"
   AC_CACHE_CHECK([for 3 arg ldap_set_rebind_proc],
ac_cv_3arg_setrebindproc,
   [AC_TRY_COMPILE([#include <ldap.h>], [ldap_set_rebind_proc(0,0,0)],
   ac_cv_3arg_setrebindproc=yes, ac_cv_3arg_setrebindproc=no)])
@@ -118,8 +120,15 @@
     AC_DEFINE(HAVE_3ARG_SETREBINDPROC,1,[Whether 3 arg
set_rebind_proc()])
   fi
   CPPFLAGS=$_SAVE_CPPFLAGS
+  LDFLAGS=$_SAVE_LDFLAGS
 
   dnl Solaris 2.8 claims to be 2004 API, but doesn't have
   dnl ldap_parse_reference() nor ldap_start_tls_s()
+  _SAVE_CPPFLAGS=$CPPFLAGS
+  _SAVE_LDFLAGS=$LDFLAGS
+  CPPFLAGS="$CPPFLAGS -I$LDAP_INCDIR"
+  LDFLAGS="$LDFLAGS -L$LDAP_LIBDIR $LDAP_SHARED_LIBADD"
   AC_CHECK_FUNCS([ldap_parse_reference ldap_start_tls_s])
+  CPPFLAGS=$_SAVE_CPPFLAGS
+  LDFLAGS=$_SAVE_LDFLAGS
 fi 

-- 
Edit bug report at http://bugs.php.net/?id=24025&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24025&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24025&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24025&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24025&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24025&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24025&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24025&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24025&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24025&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24025&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24025&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24025&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24025&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24025&r=gnused

Reply via email to