Skip to content

Commit 57f8068

Browse files
authored
PHPC-2152: Link libresolv when detecting res_nsearch (#1371)
This fixes a bug inadvertently introduced in b581f2a.
1 parent 34e2d70 commit 57f8068

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/autotools/libmongoc/CheckResolv.m4

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
dnl Disable Windows DNSAPI
22
AC_SUBST(MONGOC_HAVE_DNSAPI, 0)
33

4-
need_libresolv="no"
4+
found_resolv="no"
55

66
old_LIBS="$LIBS"
7-
dnl On AIX, resolv functions are in libc.
8-
if test "x$os_aix" = "xno"; then
7+
8+
dnl Link libresolv for detection (note: on AIX, resolv functions are in libc)
9+
if test "$os_aix" != "yes"; then
910
LIBS="$LIBS -lresolv"
1011
fi
1112

@@ -28,6 +29,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2829
AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
2930
AC_SUBST(MONGOC_HAVE_RES_NSEARCH, 1)
3031
32+
found_resolv="yes"
33+
3134
dnl We have res_nsearch. Call res_ndestroy (BSD/Mac) or res_nclose (Linux)?
3235
AC_MSG_CHECKING([for res_ndestroy])
3336
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
@@ -82,9 +85,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
8285
]])], [
8386
AC_MSG_RESULT([yes])
8487
AC_SUBST(MONGOC_HAVE_RES_SEARCH, 1)
85-
if test "x$os_aix" = "xno"; then
86-
need_libresolv="yes"
87-
fi
88+
89+
found_resolv="yes"
8890
], [
8991
AC_MSG_RESULT([no])
9092
AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
@@ -93,6 +95,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
9395

9496
LIBS="$old_LIBS"
9597

96-
AS_IF([test "$need_libresolv" = "yes"],[
98+
dnl Link libresolv if needed (note: on AIX, resolv functions are in libc)
99+
AS_IF([test "$found_resolv" = "yes" -a "$os_aix" != "yes"],[
97100
PHP_ADD_LIBRARY([resolv],,[MONGODB_SHARED_LIBADD])
98101
])

0 commit comments

Comments
 (0)