@@ -184,7 +184,7 @@ if test "$PHP_MEMCACHED" != "no"; then
184
184
else
185
185
AC_MSG_RESULT ( [ $msgpack_inc_path] )
186
186
fi
187
- fi
187
+ fi
188
188
189
189
AC_MSG_CHECKING ( [ for memcached session support] )
190
190
if test "$PHP_MEMCACHED_SESSION" != "no"; then
@@ -255,50 +255,53 @@ if test "$PHP_MEMCACHED" != "no"; then
255
255
PHP_EVAL_LIBLINE($PHP_LIBMEMCACHED_LIBS, MEMCACHED_SHARED_LIBADD)
256
256
PHP_EVAL_INCLINE($PHP_LIBMEMCACHED_INCLUDES)
257
257
258
- #
259
- # Added -lpthread here because AC_TRY_LINK tests on CentOS 6 seem to fail with undefined reference to pthread_once
260
- #
258
+ dnl # Added -lpthread here because AC_TRY_LINK tests on CentOS 6 seem to fail with undefined reference to pthread_once
261
259
ORIG_CFLAGS="$CFLAGS"
262
260
CFLAGS="$CFLAGS $INCLUDES"
263
261
262
+ dnl # Always check if libmemcached was built with SASL support,
263
+ dnl # because it will require sasl.h even if not used here.
264
+ AC_CACHE_CHECK ( [ for libmemcached sasl.h requirement] , ac_cv_memc_sasl_support , [
265
+ AC_TRY_COMPILE (
266
+ [ #include <libmemcached/memcached.h> ] ,
267
+ [
268
+ #if LIBMEMCACHED_WITH_SASL_SUPPORT
269
+ /* yes */
270
+ #else
271
+ # error "no sasl support"
272
+ #endif
273
+ ] ,
274
+ [ ac_cv_memc_sasl_support="yes" ] ,
275
+ [ ac_cv_memc_sasl_support="no" ]
276
+ )
277
+ ] )
278
+
279
+ if test "$ac_cv_memc_sasl_support" = "yes"; then
280
+ AC_CHECK_HEADERS ( [ sasl/sasl.h] , [ ac_cv_have_memc_sasl_h="yes"] , [ ac_cv_have_memc_sasl_h="no"] )
281
+ fi
282
+
283
+ dnl # If libmemcached requires sasl.h but we can't find sasl.h, that's a hard error
284
+ dnl # regardless of the option --enable-memcached-sasl or --disable-memcached-sasl
264
285
AC_MSG_CHECKING ( [ whether to enable sasl support] )
286
+ if test "$ac_cv_memc_sasl_support" = "yes" && test "$ac_cv_have_memc_sasl_h" = "no"; then
287
+ AC_MSG_ERROR ( [ no, libmemcached built with sasl required, but sasl.h not found.] )
288
+ fi
289
+
265
290
if test "$PHP_MEMCACHED_SASL" != "no"; then
266
291
AC_MSG_RESULT ( yes )
267
- AC_CHECK_HEADERS ( [ sasl/sasl.h] , [ ac_cv_have_memc_sasl_h="yes"] , [ ac_cv_have_memc_sasl_h="no"] )
268
-
269
- if test "$ac_cv_have_memc_sasl_h" = "yes"; then
270
-
271
- AC_CACHE_CHECK ( [ whether libmemcached supports sasl] , ac_cv_memc_sasl_support , [
272
- AC_TRY_COMPILE (
273
- [ #include <libmemcached/memcached.h> ] ,
274
- [
275
- #if LIBMEMCACHED_WITH_SASL_SUPPORT
276
- /* yes */
277
- #else
278
- # error "no sasl support"
279
- #endif
280
- ] ,
281
- [ ac_cv_memc_sasl_support="yes" ] ,
282
- [ ac_cv_memc_sasl_support="no" ]
283
- )
284
- ] )
285
-
286
- if test "$ac_cv_memc_sasl_support" = "yes"; then
287
- PHP_CHECK_LIBRARY(sasl2, sasl_client_init, [ PHP_ADD_LIBRARY(sasl2, 1, MEMCACHED_SHARED_LIBADD)] )
288
- AC_DEFINE ( HAVE_MEMCACHED_SASL , 1 , [ Have SASL support] )
289
- else
290
- AC_MSG_ERROR ( [ no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check] )
291
- fi
292
+ if test "$ac_cv_memc_sasl_support" = "yes" && test "$ac_cv_have_memc_sasl_h" = "yes"; then
293
+ PHP_CHECK_LIBRARY(sasl2, sasl_client_init, [ PHP_ADD_LIBRARY(sasl2, 1, MEMCACHED_SHARED_LIBADD)] )
294
+ AC_DEFINE ( HAVE_MEMCACHED_SASL , 1 , [ Have SASL support] )
292
295
else
293
- AC_MSG_ERROR ( [ no, sasl.h is not available . Run configure with --disable-memcached-sasl to disable this check ] )
296
+ AC_MSG_ERROR ( [ no, libmemcached built with sasl disabled . Run configure with --disable-memcached-sasl or update libmemcached with sasl support ] )
294
297
fi
295
298
else
296
299
AC_MSG_RESULT ( [ no] )
297
300
fi
298
301
299
302
ORIG_CFLAGS="$CFLAGS"
300
303
ORIG_LIBS="$LIBS"
301
-
304
+
302
305
CFLAGS="$CFLAGS $PHP_LIBMEMCACHED_INCLUDES"
303
306
LIBS="$LIBS $PHP_LIBMEMCACHED_LIBS"
304
307
0 commit comments