Skip to content

Commit 394eb79

Browse files
petkderickr
authored andcommitted
Replace obsolete AC_TRY_LINK with AC_LINK_IFELSE
The AC_TRY_LINK macro has been made obsolete in Autoconf 2.50 in 2001. It should be replaced with AC_LINK_IFELSE instead. Systems should by now well support this, since PHP 5.3 required Autoconf 2.13+ (released in 1999) or newer, PHP 5.4 required Autoconf 2.59+ (released in 2003), and since PHP 7.2, Autoconf 2.64+ (released in 2008) is required and for PHP 7.2 phpize the Autoconf 2.59+ is required. Refs: - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/AC_005fACT_005fIFELSE-vs-AC_005fTRY_005fACT.html - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
1 parent 4020199 commit 394eb79

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

scripts/autotools/libmongoc/CheckResolv.m4

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,52 @@ old_LIBS="$LIBS"
77
LIBS="$LIBS -lresolv"
88

99
dnl Thread-safe DNS query function for _mongoc_client_get_srv.
10-
dnl Could be a macro, not a function, so check with AC_TRY_LINK.
10+
dnl Could be a macro, not a function, so check with AC_LINK_IFELSE.
1111
AC_MSG_CHECKING([for res_nsearch])
12-
AC_TRY_LINK([
12+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1313
#include <sys/types.h>
1414
#include <netinet/in.h>
1515
#include <arpa/nameser.h>
1616
#include <resolv.h>
17-
],[
17+
]], [[
1818
int len;
1919
unsigned char reply[1024];
2020
res_state statep;
2121
len = res_nsearch(
2222
statep, "example.com", ns_c_in, ns_t_srv, reply, sizeof(reply));
23-
],[
23+
]])], [
2424
AC_MSG_RESULT([yes])
2525
AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
2626
AC_SUBST(MONGOC_HAVE_RES_NSEARCH, 1)
2727
found_resolv="yes"
2828
2929
dnl We have res_nsearch. Call res_ndestroy (BSD/Mac) or res_nclose (Linux)?
3030
AC_MSG_CHECKING([for res_ndestroy])
31-
AC_TRY_LINK([
31+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3232
#include <sys/types.h>
3333
#include <netinet/in.h>
3434
#include <arpa/nameser.h>
3535
#include <resolv.h>
36-
],[
36+
]], [[
3737
res_state statep;
3838
res_ndestroy(statep);
39-
], [
39+
]])], [
4040
AC_MSG_RESULT([yes])
4141
AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 1)
4242
AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
4343
], [
4444
AC_MSG_RESULT([no])
4545
AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 0)
4646
AC_MSG_CHECKING([for res_nclose])
47-
AC_TRY_LINK([
47+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4848
#include <sys/types.h>
4949
#include <netinet/in.h>
5050
#include <arpa/nameser.h>
5151
#include <resolv.h>
52-
],[
52+
]], [[
5353
res_state statep;
5454
res_nclose(statep);
55-
], [
55+
]])], [
5656
AC_MSG_RESULT([yes])
5757
AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 1)
5858
], [
@@ -68,16 +68,16 @@ AC_TRY_LINK([
6868
6969
dnl Thread-unsafe function.
7070
AC_MSG_CHECKING([for res_search])
71-
AC_TRY_LINK([
71+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7272
#include <sys/types.h>
7373
#include <netinet/in.h>
7474
#include <arpa/nameser.h>
7575
#include <resolv.h>
76-
],[
76+
]], [[
7777
int len;
7878
unsigned char reply[1024];
7979
len = res_search("example.com", ns_c_in, ns_t_srv, reply, sizeof(reply));
80-
], [
80+
]])], [
8181
AC_MSG_RESULT([yes])
8282
AC_SUBST(MONGOC_HAVE_RES_SEARCH, 1)
8383
found_resolv="yes"

0 commit comments

Comments
 (0)