Skip to content

Commit a0e46c3

Browse files
committed
Replace obsolete AC_TRY_FOO with AC_FOO_IFELSE
Autoconf made several macros obsolete including the AC_TRY_COMPILE and AC_TRY_LINK in 2000 and since Autoconf 2.50: http://git.savannah.gnu.org/cgit/autoconf.git/tree/ChangeLog.2 These macros should be replaced with the current AC_FOO_IFELSE instead. It is fairly safe to upgrade and take the recommendation advice of autoconf upgrade manual since the upgrade should be compatible at least with PHP versions 5.4 and up, on some systems even with PHP 5.3. PHP versions from 5.4 to 7.1 require Autoconf 2.59+ and PHP 7.2+ require Autoconf 2.64+. This patch was created with the help of autoupdate script. Reference docs: - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html - https://www.gnu.org/software/autoconf/manual/autoconf-2.59/autoconf.pdf
1 parent f5f84c5 commit a0e46c3

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

config.m4

+19-24
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,15 @@ if test "$PHP_MEMCACHED" != "no"; then
260260
dnl # Always check if libmemcached was built with SASL support,
261261
dnl # because it will require sasl.h even if not used here.
262262
AC_CACHE_CHECK([for libmemcached sasl.h requirement], ac_cv_memc_sasl_support, [
263-
AC_TRY_COMPILE(
264-
[ #include <libmemcached/memcached.h> ],
265-
[
263+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libmemcached/memcached.h>]], [[
266264
#if LIBMEMCACHED_WITH_SASL_SUPPORT
267265
/* yes */
268266
#else
269267
# error "no sasl support"
270268
#endif
271-
],
272-
[ ac_cv_memc_sasl_support="yes" ],
273-
[ ac_cv_memc_sasl_support="no" ]
269+
]])],
270+
[ac_cv_memc_sasl_support="yes"],
271+
[ac_cv_memc_sasl_support="no"]
274272
)
275273
])
276274

@@ -304,12 +302,11 @@ if test "$PHP_MEMCACHED" != "no"; then
304302
LIBS="$LIBS $PHP_LIBMEMCACHED_LIBS"
305303

306304
AC_CACHE_CHECK([whether memcached_exist is defined], ac_cv_have_memcached_exist, [
307-
AC_TRY_LINK(
308-
[ #include <libmemcached/memcached.h> ],
309-
[ memcached_exist (NULL, NULL, 0); ],
310-
[ ac_cv_have_memcached_exist="yes" ],
311-
[ ac_cv_have_memcached_exist="no" ]
312-
)
305+
AC_LINK_IFELSE(
306+
[AC_LANG_PROGRAM([[#include <libmemcached/memcached.h>]],
307+
[[memcached_exist (NULL, NULL, 0);]])],
308+
[ac_cv_have_memcached_exist="yes"],
309+
[ac_cv_have_memcached_exist="no"])
313310
])
314311

315312
CFLAGS="$ORIG_CFLAGS"
@@ -323,12 +320,11 @@ if test "$PHP_MEMCACHED" != "no"; then
323320
fi
324321

325322
AC_CACHE_CHECK([whether memcached_set_encoding_key is defined], ac_cv_have_memcached_set_encoding_key, [
326-
AC_TRY_LINK(
327-
[ #include <libmemcached/memcached.h> ],
328-
[ memcached_set_encoding_key (NULL, NULL, 0); ],
329-
[ ac_cv_have_memcached_set_encoding_key="yes" ],
330-
[ ac_cv_have_memcached_set_encoding_key="no" ]
331-
)
323+
AC_LINK_IFELSE(
324+
[AC_LANG_PROGRAM([[#include <libmemcached/memcached.h>]],
325+
[[memcached_set_encoding_key (NULL, NULL, 0);]])],
326+
[ac_cv_have_memcached_set_encoding_key="yes"],
327+
[ac_cv_have_memcached_set_encoding_key="no"])
332328
])
333329

334330
CFLAGS="$ORIG_CFLAGS"
@@ -360,13 +356,12 @@ if test "$PHP_MEMCACHED" != "no"; then
360356
AC_MSG_RESULT([enabled])
361357

362358
AC_CACHE_CHECK([whether libmemcachedprotocol is usable], ac_cv_have_libmemcachedprotocol, [
363-
AC_TRY_COMPILE(
364-
[ #include <libmemcachedprotocol-0.0/handler.h> ],
365-
[ memcached_binary_protocol_callback_st s_test_impl;
359+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libmemcachedprotocol-0.0/handler.h>]],
360+
[[memcached_binary_protocol_callback_st s_test_impl;
366361
s_test_impl.interface.v1.delete_object = 0;
367-
],
368-
[ ac_cv_have_libmemcachedprotocol="yes" ],
369-
[ ac_cv_have_libmemcachedprotocol="no" ]
362+
]])],
363+
[ac_cv_have_libmemcachedprotocol="yes"],
364+
[ac_cv_have_libmemcachedprotocol="no"]
370365
)
371366
])
372367

0 commit comments

Comments
 (0)