Skip to content

Commit 9d61036

Browse files
hughmcmasternikic
authored andcommitted
ext/ldap: Use PKG_CHECK_MODULES to detect the libsasl2 library
1 parent fa5513a commit 9d61036

File tree

4 files changed

+13
-52
lines changed

4 files changed

+13
-52
lines changed

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,9 @@ The following extensions and SAPIs are affected:
567567
. --with-icu-dir has been removed. If --enable-intl is passed, then libicu is
568568
always required.
569569

570+
- Ldap:
571+
. --with-ldap-sasl no longer accepts a directory.
572+
570573
- Libxml:
571574
. --with-libxml-dir has been removed.
572575
. --enable-libxml becomes --with-libxml.

ext/ldap/config.m4

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41,59 +41,15 @@ AC_DEFUN([PHP_LDAP_CHECKS], [
4141
fi
4242
])
4343

44-
AC_DEFUN([PHP_LDAP_SASL_CHECKS], [
45-
if test "$1" = "yes"; then
46-
SEARCH_DIRS="/usr/local /usr"
47-
else
48-
SEARCH_DIRS=$1
49-
fi
50-
51-
for i in $SEARCH_DIRS; do
52-
if test -f $i/include/sasl/sasl.h; then
53-
LDAP_SASL_DIR=$i
54-
AC_DEFINE(HAVE_LDAP_SASL_SASL_H,1,[ ])
55-
break
56-
elif test -f $i/include/sasl.h; then
57-
LDAP_SASL_DIR=$i
58-
AC_DEFINE(HAVE_LDAP_SASL_H,1,[ ])
59-
break
60-
fi
61-
done
62-
63-
if test "$LDAP_SASL_DIR"; then
64-
LDAP_SASL_INCDIR=$LDAP_SASL_DIR/include
65-
LDAP_SASL_LIBDIR=$LDAP_SASL_DIR/$PHP_LIBDIR
66-
else
67-
AC_MSG_ERROR([sasl.h not found!])
68-
fi
69-
70-
if test "$PHP_LDAP_SASL" = "yes"; then
71-
SASL_LIB="-lsasl2"
72-
else
73-
SASL_LIB="-L$LDAP_SASL_LIBDIR -lsasl2"
74-
fi
75-
76-
PHP_CHECK_LIBRARY(sasl2, sasl_version,
77-
[
78-
PHP_ADD_INCLUDE($LDAP_SASL_INCDIR)
79-
PHP_ADD_LIBRARY_WITH_PATH(sasl2, $LDAP_SASL_LIBDIR, LDAP_SHARED_LIBADD)
80-
AC_DEFINE(HAVE_LDAP_SASL, 1, [LDAP SASL support])
81-
], [
82-
AC_MSG_ERROR([LDAP SASL check failed. Please check config.log for more information.])
83-
], [
84-
$LDAP_SHARED_LIBADD $SASL_LIB
85-
])
86-
])
87-
8844
PHP_ARG_WITH([ldap],
8945
[for LDAP support],
9046
[AS_HELP_STRING([[--with-ldap[=DIR]]],
9147
[Include LDAP support])])
9248

9349
PHP_ARG_WITH([ldap-sasl],
94-
[for LDAP Cyrus SASL support],
95-
[AS_HELP_STRING([[--with-ldap-sasl[=DIR]]],
96-
[LDAP: Include Cyrus SASL support])],
50+
[whether to build with LDAP Cyrus SASL support],
51+
[AS_HELP_STRING([--with-ldap-sasl],
52+
[LDAP: Build with Cyrus SASL support])],
9753
[no],
9854
[no])
9955

@@ -216,7 +172,12 @@ if test "$PHP_LDAP" != "no"; then
216172

217173
dnl SASL check
218174
if test "$PHP_LDAP_SASL" != "no"; then
219-
PHP_LDAP_SASL_CHECKS([$PHP_LDAP_SASL])
175+
PKG_CHECK_MODULES([SASL], [libsasl2])
176+
177+
PHP_EVAL_INCLINE($SASL_CFLAGS)
178+
PHP_EVAL_LIBLINE($SASL_LIBS, LDAP_SHARED_LIBADD)
179+
180+
AC_DEFINE(HAVE_LDAP_SASL, 1, [LDAP SASL support])
220181
fi
221182

222183
dnl Sanity check

ext/ldap/config.w32

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ if (PHP_LDAP != "no") {
1717
AC_DEFINE('HAVE_LDAP_START_TLS_S', 1);
1818
AC_DEFINE('HAVE_LDAP', 1);
1919
AC_DEFINE('HAVE_LDAP_SASL', 1);
20-
AC_DEFINE('HAVE_LDAP_SASL_SASL_H', 1);
2120
AC_DEFINE('LDAP_DEPRECATED', 1);
2221
AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1);
2322
AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1);

ext/ldap/ldap.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@
5353
#include "ext/standard/php_string.h"
5454
#include "ext/standard/info.h"
5555

56-
#ifdef HAVE_LDAP_SASL_H
57-
#include <sasl.h>
58-
#elif defined(HAVE_LDAP_SASL_SASL_H)
56+
#ifdef HAVE_LDAP_SASL
5957
#include <sasl/sasl.h>
6058
#endif
6159

0 commit comments

Comments
 (0)