Skip to content

PHPC-2133: Fix building with SRV support on FreeBSD #1432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions scripts/autotools/libmongoc/CheckResolv.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ dnl Disable Windows DNSAPI
AC_SUBST(MONGOC_HAVE_DNSAPI, 0)

found_resolv="no"
libc_has_resolv="no"

old_LIBS="$LIBS"
if test "$os_aix" = "yes" -o "$os_freebsd" = "yes"; then
libc_has_resolv="yes"
fi

dnl Link libresolv for detection (note: on AIX, resolv functions are in libc)
if test "$os_aix" != "yes"; then
LIBS="$LIBS -lresolv"
dnl Temporarily link libresolv for detection if necessary
if test "$libc_has_resolv" = "no"; then
old_LIBS="$LIBS"
LIBS="$LIBS -lresolv"
fi

dnl Thread-safe DNS query function for _mongoc_client_get_srv.
Expand Down Expand Up @@ -93,9 +97,10 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
])
])

LIBS="$old_LIBS"
if test "$libc_has_resolv" = "no"; then
LIBS="$old_LIBS"

dnl Link libresolv if needed (note: on AIX, resolv functions are in libc)
AS_IF([test "$found_resolv" = "yes" -a "$os_aix" != "yes"],[
PHP_ADD_LIBRARY([resolv],,[MONGODB_SHARED_LIBADD])
])
AS_IF([test "$found_resolv" = "yes"],[
PHP_ADD_LIBRARY([resolv],,[MONGODB_SHARED_LIBADD])
])
fi
6 changes: 6 additions & 0 deletions scripts/autotools/libmongoc/PlatformFlags.m4
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
dnl Ignore OpenSSL deprecation warnings on OSX
AS_IF([test "$os_darwin" = "yes"],
[AX_CHECK_COMPILE_FLAG([-Wno-deprecated-declarations], [STD_CFLAGS="$STD_CFLAGS -Wno-deprecated-declarations"])])

dnl We know there are some cast-align issues on OSX
AS_IF([test "$os_darwin" = "yes"],
[AX_CHECK_COMPILE_FLAG([-Wno-cast-align], [STD_CFLAGS="$STD_CFLAGS -Wno-cast-align"])])
AS_IF([test "$os_darwin" = "yes"],
[AX_CHECK_COMPILE_FLAG([-Wno-unneeded-internal-declaration], [STD_CFLAGS="$STD_CFLAGS -Wno-unneeded-internal-declaration"])])
AS_IF([test "$os_darwin" = "yes"],
[AX_CHECK_COMPILE_FLAG([-Wno-error=unused-command-line-argument], [STD_CFLAGS="$STD_CFLAGS -Wno-error=unused-command-line-argument"])])

dnl Enable non-standard features on FreeBSD with __BSD_VISIBLE=1
if test "$os_freebsd" = "yes"; then
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D__BSD_VISIBLE=1"
fi