com php-src: ext/ldap: Use PKG_CHECK_MODULES to detect the libsasl2 library: UPGRADING ext/ldap/config .m4 ext/ldap/config.w32 ext/ldap/ldap.c
| From: | Nikita Popov | Date: | Tue, 11 Jun 2019 15:11:53 +0000 |
| Subject: | com php-src: ext/ldap: Use PKG_CHECK_MODULES to detect the libsasl2 library: UPGRADING ext/ldap/config .m4 ext/ldap/config.w32 ext/ldap/ldap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106681@lists.php.net to get a copy of this message | ||
Commit: 9d6103665162f29b7621493b0c5c4a613731a1c9
Author: Hugh McMaster <hugh.mcmaster@outlook.com> Wed, 5 Jun 2019 22:57:09 +1000
Committer: Nikita Popov <nikita.ppv@gmail.com> Tue, 11 Jun 2019 17:11:53 +0200
Parents: fa5513aefeda5c3ff15d9d578de8c71390bece3e
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9d6103665162f29b7621493b0c5c4a613731a1c9
Log:
ext/ldap: Use PKG_CHECK_MODULES to detect the libsasl2 library
Changed paths:
M UPGRADING
M ext/ldap/config.m4
M ext/ldap/config.w32
M ext/ldap/ldap.c
Diff:
diff --git a/UPGRADING b/UPGRADING
index eceb9b6..66be319 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -567,6 +567,9 @@ The following extensions and SAPIs are affected:
. --with-icu-dir has been removed. If --enable-intl is passed, then libicu is
always required.
+- Ldap:
+ . --with-ldap-sasl no longer accepts a directory.
+
- Libxml:
. --with-libxml-dir has been removed.
. --enable-libxml becomes --with-libxml.
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
index 1812cb0..fff818b 100644
--- a/ext/ldap/config.m4
+++ b/ext/ldap/config.m4
@@ -41,59 +41,15 @@ AC_DEFUN([PHP_LDAP_CHECKS], [
fi
])
-AC_DEFUN([PHP_LDAP_SASL_CHECKS], [
- if test "$1" = "yes"; then
- SEARCH_DIRS="/usr/local /usr"
- else
- SEARCH_DIRS=$1
- fi
-
- for i in $SEARCH_DIRS; do
- if test -f $i/include/sasl/sasl.h; then
- LDAP_SASL_DIR=$i
- AC_DEFINE(HAVE_LDAP_SASL_SASL_H,1,[ ])
- break
- elif test -f $i/include/sasl.h; then
- LDAP_SASL_DIR=$i
- AC_DEFINE(HAVE_LDAP_SASL_H,1,[ ])
- break
- fi
- done
-
- if test "$LDAP_SASL_DIR"; then
- LDAP_SASL_INCDIR=$LDAP_SASL_DIR/include
- LDAP_SASL_LIBDIR=$LDAP_SASL_DIR/$PHP_LIBDIR
- else
- AC_MSG_ERROR([sasl.h not found!])
- fi
-
- if test "$PHP_LDAP_SASL" = "yes"; then
- SASL_LIB="-lsasl2"
- else
- SASL_LIB="-L$LDAP_SASL_LIBDIR -lsasl2"
- fi
-
- PHP_CHECK_LIBRARY(sasl2, sasl_version,
- [
- PHP_ADD_INCLUDE($LDAP_SASL_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(sasl2, $LDAP_SASL_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_LDAP_SASL, 1, [LDAP SASL support])
- ], [
- AC_MSG_ERROR([LDAP SASL check failed. Please check config.log for more information.])
- ], [
- $LDAP_SHARED_LIBADD $SASL_LIB
- ])
-])
-
PHP_ARG_WITH([ldap],
[for LDAP support],
[AS_HELP_STRING([[--with-ldap[=DIR]]],
[Include LDAP support])])
PHP_ARG_WITH([ldap-sasl],
- [for LDAP Cyrus SASL support],
- [AS_HELP_STRING([[--with-ldap-sasl[=DIR]]],
- [LDAP: Include Cyrus SASL support])],
+ [whether to build with LDAP Cyrus SASL support],
+ [AS_HELP_STRING([--with-ldap-sasl],
+ [LDAP: Build with Cyrus SASL support])],
[no],
[no])
@@ -216,7 +172,12 @@ if test "$PHP_LDAP" != "no"; then
dnl SASL check
if test "$PHP_LDAP_SASL" != "no"; then
- PHP_LDAP_SASL_CHECKS([$PHP_LDAP_SASL])
+ PKG_CHECK_MODULES([SASL], [libsasl2])
+
+ PHP_EVAL_INCLINE($SASL_CFLAGS)
+ PHP_EVAL_LIBLINE($SASL_LIBS, LDAP_SHARED_LIBADD)
+
+ AC_DEFINE(HAVE_LDAP_SASL, 1, [LDAP SASL support])
fi
dnl Sanity check
diff --git a/ext/ldap/config.w32 b/ext/ldap/config..w32
index 49f740b..b947aa5 100644
--- a/ext/ldap/config.w32
+++ b/ext/ldap/config.w32
@@ -17,7 +17,6 @@ if (PHP_LDAP != "no") {
AC_DEFINE('HAVE_LDAP_START_TLS_S', 1);
AC_DEFINE('HAVE_LDAP', 1);
AC_DEFINE('HAVE_LDAP_SASL', 1);
- AC_DEFINE('HAVE_LDAP_SASL_SASL_H', 1);
AC_DEFINE('LDAP_DEPRECATED', 1);
AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1);
AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1);
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 8a91e50...f1486cd 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -53,9 +53,7 @@
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
-#ifdef HAVE_LDAP_SASL_H
-#include <sasl.h>
-#elif defined(HAVE_LDAP_SASL_SASL_H)
+#ifdef HAVE_LDAP_SASL
#include <sasl/sasl.h>
#endif