fix #107
authorMichael Wallner <mike@php.net>
Tue, 21 Feb 2023 10:33:46 +0000 (11:33 +0100)
committerMichael Wallner <mike@php.net>
Tue, 21 Feb 2023 15:55:36 +0000 (16:55 +0100)
use PKG_CONFIG_PATH="/opt/homebrew/opt/cyrus-sasl/lib/pkgconfig" on
macOS to avoid the system's sasl2 lib in favor of the official one

CMake/_Include.cmake
src/libmemcached/sasl.cc

index 901375d70e7fddd431aa0ccadec5d82c1405bfa6..7466b4cab006a29244b316b50c24ab5d7d642016 100644 (file)
@@ -131,6 +131,11 @@ if(ENABLE_SASL)
     if(HAVE_LIBSASL)
         set(LIBMEMCACHED_WITH_SASL_SUPPORT 1)
         pkgconfig_export(REQUIRES libsasl2)
+        cmake_push_check_state()
+        set(CMAKE_REQUIRED_INCLUDES "${LIBSASL_INCLUDEDIR}")
+        set(CMAKE_REQUIRED_LIBRARIES "${LIBSASL_LIBRARIES}")
+        check_symbol(sasl_client_done sasl/sasl.h)
+        cmake_pop_check_state()
     endif()
 endif()
 
index 21a53de4b10ad7050c91864091a56a71b7562c0b..90f663a1262453deb530dfa4a4637b2d9b900371 100644 (file)
@@ -92,7 +92,11 @@ static memcached_return_t resolve_names(memcached_instance_st &server, char *lad
 extern "C" {
 
 static void sasl_shutdown_function() {
+#if HAVE_SASL_CLIENT_DONE
+  (void) sasl_client_done();
+#else
   sasl_done();
+#endif
 }
 
 static std::atomic<int> sasl_startup_state(SASL_OK);