]> granicus.if.org Git - php/commitdiff
ext/ldap: Use PKG_CHECK_MODULES to detect the libsasl2 library
authorHugh McMaster <hugh.mcmaster@outlook.com>
Wed, 5 Jun 2019 12:57:09 +0000 (22:57 +1000)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 11 Jun 2019 15:11:53 +0000 (17:11 +0200)
UPGRADING
ext/ldap/config.m4
ext/ldap/config.w32
ext/ldap/ldap.c

index eceb9b6f0ad9d30cca196026c5c25f728cd0d4e8..66be319cb9b2d305bc12b33ec9c7f0b3c1fd252c 100644 (file)
--- 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.
index 1812cb0e0b950d505eb50145d70ad4c5aff8528b..fff818b8f40fba3e86a76420e79320afd73b3969 100644 (file)
@@ -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
index 49f740bd6514030a06e940cc8fcaf1a1e3d1b08b..b947aa5177ca3ec63ccbd9d3b4e6095094fdbed5 100644 (file)
@@ -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);
index 8a91e5060c48a27ef8352567e5501aeb9af5f49a..f1486cd315437ac86bf54372f774b25e4fe63859 100644 (file)
@@ -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