1dnl 2dnl $Id$ 3dnl 4 5AC_DEFUN([PHP_LDAP_CHECKS], [ 6 if test -f $1/include/ldap.h; then 7 LDAP_DIR=$1 8 LDAP_INCDIR=$1/include 9 LDAP_LIBDIR=$1/$PHP_LIBDIR 10 elif test -f $1/include/umich-ldap/ldap.h; then 11 LDAP_DIR=$1 12 LDAP_INCDIR=$1/include/umich-ldap 13 LDAP_LIBDIR=$1/$PHP_LIBDIR 14 elif test -f $1/ldap/public/ldap.h; then 15 LDAP_DIR=$1 16 LDAP_INCDIR=$1/ldap/public 17 LDAP_LIBDIR=$1/$PHP_LIBDIR 18 else 19 20 dnl Find Oracle Instant Client RPM header location corresponding to the given lib path e.g. for --with-ldap=/usr/lib/oracle/12.1/client64/lib 21 AC_CHECK_SIZEOF(long int, 4) 22 if test "$ac_cv_sizeof_long_int" = "4"; then 23 PHP_OCI8_IC_LIBDIR_SUFFIX="" 24 else 25 PHP_OCI8_IC_LIBDIR_SUFFIX=64 26 fi 27 OCISDKRPMINC=`echo "$1" | $SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'` 28 29 dnl Check for Oracle Instant Client RPM install 30 if test -f $OCISDKRPMINC/ldap.h; then 31 LDAP_DIR=$1 32 LDAP_INCDIR=$OCISDKRPMINC 33 LDAP_LIBDIR=$1 34 dnl Check for Oracle Instant Client ZIP install 35 elif test -f $1/sdk/include/ldap.h; then 36 LDAP_DIR=$1 37 LDAP_INCDIR=$1/sdk/include 38 LDAP_LIBDIR=$1 39 fi 40 fi 41]) 42 43AC_DEFUN([PHP_LDAP_SASL_CHECKS], [ 44 if test "$1" = "yes"; then 45 SEARCH_DIRS="/usr/local /usr" 46 else 47 SEARCH_DIRS=$1 48 fi 49 50 for i in $SEARCH_DIRS; do 51 if test -f $i/include/sasl/sasl.h; then 52 LDAP_SASL_DIR=$i 53 AC_DEFINE(HAVE_LDAP_SASL_SASL_H,1,[ ]) 54 break 55 elif test -f $i/include/sasl.h; then 56 LDAP_SASL_DIR=$i 57 AC_DEFINE(HAVE_LDAP_SASL_H,1,[ ]) 58 break 59 fi 60 done 61 62 if test "$LDAP_SASL_DIR"; then 63 LDAP_SASL_INCDIR=$LDAP_SASL_DIR/include 64 LDAP_SASL_LIBDIR=$LDAP_SASL_DIR/$PHP_LIBDIR 65 else 66 AC_MSG_ERROR([sasl.h not found!]) 67 fi 68 69 if test "$PHP_LDAP_SASL" = "yes"; then 70 SASL_LIB="-lsasl2" 71 else 72 SASL_LIB="-L$LDAP_SASL_LIBDIR -lsasl2" 73 fi 74 75 PHP_CHECK_LIBRARY(sasl2, sasl_version, 76 [ 77 PHP_ADD_INCLUDE($LDAP_SASL_INCDIR) 78 PHP_ADD_LIBRARY_WITH_PATH(sasl2, $LDAP_SASL_LIBDIR, LDAP_SHARED_LIBADD) 79 AC_DEFINE(HAVE_LDAP_SASL, 1, [LDAP SASL support]) 80 ], [ 81 AC_MSG_ERROR([LDAP SASL check failed. Please check config.log for more information.]) 82 ], [ 83 $LDAP_SHARED_LIBADD $SASL_LIB 84 ]) 85]) 86 87PHP_ARG_WITH(ldap,for LDAP support, 88[ --with-ldap[=DIR] Include LDAP support]) 89 90PHP_ARG_WITH(ldap-sasl,for LDAP Cyrus SASL support, 91[ --with-ldap-sasl[=DIR] LDAP: Include Cyrus SASL support], no, no) 92 93if test "$PHP_LDAP" != "no"; then 94 95 PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1) 96 97 if test "$PHP_LDAP" = "yes"; then 98 for i in /usr/local /usr; do 99 PHP_LDAP_CHECKS($i) 100 done 101 else 102 PHP_LDAP_CHECKS($PHP_LDAP) 103 fi 104 105 if test -z "$LDAP_DIR"; then 106 AC_MSG_ERROR(Cannot find ldap.h) 107 fi 108 109 dnl The Linux version of the SDK need -lpthread 110 dnl I have tested Solaris, and it doesn't, but others may. Add 111 dnl these here if necessary. -RL 112 dnl Is this really necessary? -Troels Arvin 113 114 if test `uname` = "Linux"; then 115 LDAP_PTHREAD=pthread 116 else 117 LDAP_PTHREAD= 118 fi 119 120 if test -f $LDAP_LIBDIR/liblber.a || test -f $LDAP_LIBDIR/liblber.$SHLIB_SUFFIX_NAME; then 121 PHP_ADD_LIBRARY_WITH_PATH(lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 122 PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 123 124 elif test -f $LDAP_LIBDIR/libldap.$SHLIB_SUFFIX_NAME || test -f $LDAP_LIBDIR/libldap.$SHLIB_SUFFIX_NAME.3 || test -f $LDAP_LIBDIR/libldap.3.dylib; then 125 PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 126 127 elif test -f $LDAP_LIBDIR/libssldap50.$SHLIB_SUFFIX_NAME; then 128 if test -n "$LDAP_PTHREAD"; then 129 PHP_ADD_LIBRARY($LDAP_PTHREAD) 130 fi 131 PHP_ADD_LIBRARY_WITH_PATH(nspr4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 132 PHP_ADD_LIBRARY_WITH_PATH(plc4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 133 PHP_ADD_LIBRARY_WITH_PATH(plds4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 134 PHP_ADD_LIBRARY_WITH_PATH(ssldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 135 PHP_ADD_LIBRARY_WITH_PATH(ldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 136 PHP_ADD_LIBRARY_WITH_PATH(prldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 137 PHP_ADD_LIBRARY_WITH_PATH(ssl3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 138 AC_DEFINE(HAVE_NSLDAP,1,[ ]) 139 140 elif test -f $LDAP_LIBDIR/libldapssl41.$SHLIB_SUFFIX_NAME; then 141 if test -n "$LDAP_PTHREAD"; then 142 PHP_ADD_LIBRARY($LDAP_PTHREAD) 143 fi 144 PHP_ADD_LIBRARY_WITH_PATH(nspr3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 145 PHP_ADD_LIBRARY_WITH_PATH(plc3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 146 PHP_ADD_LIBRARY_WITH_PATH(plds3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 147 PHP_ADD_LIBRARY_WITH_PATH(ldapssl41, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 148 AC_DEFINE(HAVE_NSLDAP,1,[ ]) 149 150 elif test -f $LDAP_LIBDIR/libldapssl30.$SHLIB_SUFFIX_NAME; then 151 if test -n "$LDAP_PTHREAD"; then 152 PHP_ADD_LIBRARY($LDAP_PTHREAD) 153 fi 154 PHP_ADD_LIBRARY_WITH_PATH(ldapssl30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 155 AC_DEFINE(HAVE_NSLDAP,1,[ ]) 156 157 elif test -f $LDAP_LIBDIR/libldap30.$SHLIB_SUFFIX_NAME; then 158 if test -n "$LDAP_PTHREAD"; then 159 PHP_ADD_LIBRARY($LDAP_PTHREAD) 160 fi 161 PHP_ADD_LIBRARY_WITH_PATH(ldap30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 162 AC_DEFINE(HAVE_NSLDAP,1,[ ]) 163 164 elif test -f $LDAP_LIBDIR/libumich_ldap.$SHLIB_SUFFIX_NAME; then 165 PHP_ADD_LIBRARY_WITH_PATH(umich_lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 166 PHP_ADD_LIBRARY_WITH_PATH(umich_ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 167 168 elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.12.1; then 169 PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 170 AC_DEFINE(HAVE_ORALDAP,1,[ ]) 171 AC_DEFINE(HAVE_ORALDAP_12,1,[ ]) 172 173 elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then 174 PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 175 AC_DEFINE(HAVE_ORALDAP,1,[ ]) 176 AC_DEFINE(HAVE_ORALDAP_11,1,[ ]) 177 178 elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then 179 PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) 180 AC_DEFINE(HAVE_ORALDAP,1,[ ]) 181 AC_DEFINE(HAVE_ORALDAP_10,1,[ ]) 182 183 else 184 AC_MSG_ERROR(Cannot find ldap libraries in $LDAP_LIBDIR.) 185 fi 186 187 PHP_ADD_INCLUDE($LDAP_INCDIR) 188 PHP_SUBST(LDAP_SHARED_LIBADD) 189 AC_DEFINE(HAVE_LDAP,1,[ ]) 190 191 dnl Save original values 192 _SAVE_CPPFLAGS=$CPPFLAGS 193 _SAVE_LIBS=$LIBS 194 CPPFLAGS="$CPPFLAGS -I$LDAP_INCDIR" 195 LIBS="$LIBS $LDAP_SHARED_LIBADD" 196 197 dnl Check for 3 arg ldap_set_rebind_proc 198 AC_CACHE_CHECK([for 3 arg ldap_set_rebind_proc], ac_cv_3arg_setrebindproc, 199 [AC_TRY_COMPILE([#include <ldap.h>], [ldap_set_rebind_proc(0,0,0)], 200 ac_cv_3arg_setrebindproc=yes, ac_cv_3arg_setrebindproc=no)]) 201 if test "$ac_cv_3arg_setrebindproc" = yes; then 202 AC_DEFINE(HAVE_3ARG_SETREBINDPROC,1,[Whether 3 arg set_rebind_proc()]) 203 fi 204 205 dnl Solaris 2.8 claims to be 2004 API, but doesn't have 206 dnl ldap_parse_reference() nor ldap_start_tls_s() 207 AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference ldap_start_tls_s ldap_control_find]) 208 209 dnl 210 dnl SASL check 211 dnl 212 if test "$PHP_LDAP_SASL" != "no"; then 213 PHP_LDAP_SASL_CHECKS([$PHP_LDAP_SASL]) 214 fi 215 216 dnl 217 dnl Sanity check 218 dnl 219 AC_CHECK_FUNC(ldap_bind_s, [], [ 220 AC_MSG_ERROR([LDAP build check failed. Please check config.log for more information.]) 221 ]) 222 223 dnl Restore original values 224 CPPFLAGS=$_SAVE_CPPFLAGS 225 LIBS=$_SAVE_LIBS 226fi 227