@@ -18,9 +18,56 @@ AC_DEFUN(PHP_LDAP_CHECKS, [
18
18
fi
19
19
] )
20
20
21
+ AC_DEFUN ( PHP_LDAP_SASL_CHECKS , [
22
+ if test "$1 " = "yes"; then
23
+ SEARCH_DIRS="/usr/local /usr"
24
+ else
25
+ SEARCH_DIRS=$1
26
+ fi
27
+
28
+ for i in $SEARCH_DIRS; do
29
+ if test -f $i/include/sasl/sasl.h; then
30
+ LDAP_SASL_DIR=$i
31
+ AC_DEFINE ( HAVE_LDAP_SASL_SASL_H ,1 ,[ ] )
32
+ break
33
+ elif test -f $i/include/sasl.h; then
34
+ LDAP_SASL_DIR=$i
35
+ AC_DEFINE ( HAVE_LDAP_SASL_H ,1 ,[ ] )
36
+ break
37
+ fi
38
+ done
39
+
40
+ if test "$LDAP_SASL_DIR"; then
41
+ LDAP_SASL_INCDIR=$LDAP_SASL_DIR/include
42
+ LDAP_SASL_LIBDIR=$LDAP_SASL_DIR/lib
43
+ else
44
+ AC_MSG_ERROR ( [ sasl.h not found!] )
45
+ fi
46
+
47
+ if test "$PHP_LDAP_SASL" = "yes"; then
48
+ SASL_LIB="-lsasl2"
49
+ else
50
+ SASL_LIB="-L$LDAP_SASL_LIBDIR -lsasl2"
51
+ fi
52
+
53
+ PHP_CHECK_LIBRARY(ldap, sasl_version,
54
+ [
55
+ PHP_ADD_INCLUDE($LDAP_SASL_INCDIR)
56
+ PHP_ADD_LIBRARY_WITH_PATH(sasl2, $LDAP_SASL_LIBDIR, LDAP_SHARED_LIBADD)
57
+ AC_DEFINE ( HAVE_LDAP_SASL , 1 , [ LDAP SASL support] )
58
+ ] , [
59
+ AC_MSG_ERROR ( [ LDAP SASL check failed. Please check config.log for more information.] )
60
+ ] , [
61
+ $LDAP_SHARED_LIBADD $SASL_LIB
62
+ ] )
63
+ ] )
64
+
21
65
PHP_ARG_WITH(ldap,for LDAP support,
22
66
[ --with-ldap[ =DIR] Include LDAP support.] )
23
67
68
+ PHP_ARG_WITH(ldap-sasl,for LDAP Cyrus SASL support,
69
+ [ --with-ldap-sasl[ =DIR] LDAP: Include Cyrus SASL support.] , no, no)
70
+
24
71
if test "$PHP_LDAP" != "no"; then
25
72
26
73
PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared)
@@ -121,5 +168,19 @@ if test "$PHP_LDAP" != "no"; then
121
168
122
169
dnl Solaris 2.8 claims to be 2004 API, but doesn't have
123
170
dnl ldap_parse_reference() nor ldap_start_tls_s()
124
- AC_CHECK_FUNCS ( [ ldap_parse_reference ldap_start_tls_s ldap_sasl_interactive_bind_s] )
171
+ AC_CHECK_FUNCS ( [ ldap_parse_reference ldap_start_tls_s] )
172
+
173
+ dnl
174
+ dnl SASL check
175
+ dnl
176
+ if test "$PHP_LDAP_SASL" != "no"; then
177
+ PHP_LDAP_SASL_CHECKS([ $PHP_LDAP_SASL] )
178
+ fi
179
+
180
+ dnl
181
+ dnl Sanity check
182
+ dnl
183
+ AC_CHECK_FUNC ( ldap_bind_s , [ ] , [
184
+ AC_MSG_ERROR ( [ LDAP build check failed. Please check config.log for more information.] )
185
+ ] )
125
186
fi
0 commit comments