@@ -291,15 +291,12 @@ if test "$PHP_MEMCACHED" != "no"; then
291291 PHP_EVAL_LIBLINE($PHP_LIBMEMCACHED_LIBS, MEMCACHED_SHARED_LIBADD)
292292 PHP_EVAL_INCLINE($PHP_LIBMEMCACHED_INCLUDES)
293293
294- ORIG_CFLAGS="$CFLAGS"
295- ORIG_LIBS="$LIBS"
296-
297- CFLAGS="$CFLAGS $PHP_LIBMEMCACHED_INCLUDES"
298-
299294 #
300295 # Added -lpthread here because AC_TRY_LINK tests on CentOS 6 seem to fail with undefined reference to pthread_once
301296 #
302- LIBS="$LIBS -lpthread $PHP_LIBMEMCACHED_LIBS"
297+ LIBS="$LIBS -lpthread"
298+ ORIG_CFLAGS="$CFLAGS"
299+ CFLAGS="$CFLAGS $INCLUDES"
303300
304301 AC_CACHE_CHECK ( [ whether memcached_instance_st is defined] , ac_cv_have_memcached_instance_st , [
305302 AC_TRY_COMPILE (
@@ -358,7 +355,6 @@ if test "$PHP_MEMCACHED" != "no"; then
358355 AC_MSG_CHECKING ( [ whether to enable sasl support] )
359356 if test "$PHP_MEMCACHED_SASL" != "no"; then
360357 AC_MSG_RESULT ( yes )
361-
362358 AC_CHECK_HEADERS ( [ sasl/sasl.h] , [ ac_cv_have_memc_sasl_h="yes"] , [ ac_cv_have_memc_sasl_h="no"] )
363359
364360 if test "$ac_cv_have_memc_sasl_h" = "yes"; then
@@ -379,6 +375,7 @@ if test "$PHP_MEMCACHED" != "no"; then
379375 ] )
380376
381377 if test "$ac_cv_memc_sasl_support" = "yes"; then
378+ PHP_CHECK_LIBRARY(sasl2, sasl_client_init, [ PHP_ADD_LIBRARY(sasl2, 1, MEMCACHED_SHARED_LIBADD)] )
382379 AC_DEFINE ( HAVE_MEMCACHED_SASL , 1 , [ Have SASL support] )
383380 else
384381 AC_MSG_ERROR ( [ no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check] )
@@ -390,9 +387,6 @@ if test "$PHP_MEMCACHED" != "no"; then
390387 AC_MSG_RESULT ( [ no] )
391388 fi
392389
393- CFLAGS="$ORIG_CFLAGS"
394- LIBS="$ORIG_LIBS"
395-
396390 if test "$ac_cv_have_memcached_instance_st" = "yes"; then
397391 AC_DEFINE ( HAVE_MEMCACHED_INSTANCE_ST , [ 1] , [ Whether memcached_instance_st is defined] )
398392 fi
@@ -428,9 +422,6 @@ if test "$PHP_MEMCACHED" != "no"; then
428422 if test "$PHP_MEMCACHED_PROTOCOL" != "no"; then
429423 AC_MSG_RESULT ( [ enabled] )
430424
431- ORIG_CFLAGS="$CFLAGS"
432- CFLAGS="$CFLAGS $PHP_LIBMEMCACHED_INCLUDES"
433-
434425 AC_CACHE_CHECK ( [ whether libmemcachedprotocol is usable] , ac_cv_have_libmemcachedprotocol , [
435426 AC_TRY_COMPILE (
436427 [ #include <libmemcachedprotocol-0.0/handler.h> ] ,
@@ -441,7 +432,6 @@ if test "$PHP_MEMCACHED" != "no"; then
441432 [ ac_cv_have_libmemcachedprotocol="no" ]
442433 )
443434 ] )
444- CFLAGS="$ORIG_CFLAGS"
445435
446436 if test "$ac_cv_have_libmemcachedprotocol" != "yes"; then
447437 AC_MSG_ERROR ( [ Cannot enable libmemcached protocol] )
@@ -469,6 +459,8 @@ if test "$PHP_MEMCACHED" != "no"; then
469459 AC_MSG_RESULT ( [ disabled] )
470460 fi
471461
462+ CFLAGS="$ORIG_CFLAGS"
463+
472464 export PKG_CONFIG_PATH="$ORIG_PKG_CONFIG_PATH"
473465 PHP_SUBST(MEMCACHED_SHARED_LIBADD)
474466
0 commit comments