Skip to content

Commit f57b070

Browse files
committed
Allow --with-bonjour to work with non-macOS implementations of Bonjour.
On macOS the relevant functions require no special library, but elsewhere we need to pull in libdns_sd. Back-patch to supported branches. No docs change since the docs do not suggest that this is a Mac-only feature. Luke Lonergan Discussion: https://postgr.es/m/2D8331C5-D64F-44C1-8717-63EDC6EAF7EB@brightforge.com
1 parent 1786cda commit f57b070

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

configure

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9776,6 +9776,64 @@ else
97769776
fi
97779777

97789778

9779+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing DNSServiceRefSockFD" >&5
9780+
$as_echo_n "checking for library containing DNSServiceRefSockFD... " >&6; }
9781+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
9782+
$as_echo_n "(cached) " >&6
9783+
else
9784+
ac_func_search_save_LIBS=$LIBS
9785+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9786+
/* end confdefs.h. */
9787+
9788+
/* Override any GCC internal prototype to avoid an error.
9789+
Use char because int might match the return type of a GCC
9790+
builtin and then its argument prototype would still apply. */
9791+
#ifdef __cplusplus
9792+
extern "C"
9793+
#endif
9794+
char DNSServiceRefSockFD ();
9795+
int
9796+
main ()
9797+
{
9798+
return DNSServiceRefSockFD ();
9799+
;
9800+
return 0;
9801+
}
9802+
_ACEOF
9803+
for ac_lib in '' dns_sd; do
9804+
if test -z "$ac_lib"; then
9805+
ac_res="none required"
9806+
else
9807+
ac_res=-l$ac_lib
9808+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9809+
fi
9810+
if ac_fn_c_try_link "$LINENO"; then :
9811+
ac_cv_search_DNSServiceRefSockFD=$ac_res
9812+
fi
9813+
rm -f core conftest.err conftest.$ac_objext \
9814+
conftest$ac_exeext
9815+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
9816+
break
9817+
fi
9818+
done
9819+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
9820+
9821+
else
9822+
ac_cv_search_DNSServiceRefSockFD=no
9823+
fi
9824+
rm conftest.$ac_ext
9825+
LIBS=$ac_func_search_save_LIBS
9826+
fi
9827+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_DNSServiceRefSockFD" >&5
9828+
$as_echo "$ac_cv_search_DNSServiceRefSockFD" >&6; }
9829+
ac_res=$ac_cv_search_DNSServiceRefSockFD
9830+
if test "$ac_res" != no; then :
9831+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9832+
9833+
else
9834+
as_fn_error $? "could not find function 'DNSServiceRefSockFD' required for Bonjour" "$LINENO" 5
9835+
fi
9836+
97799837
fi
97809838

97819839
# for contrib/uuid-ossp

configure.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,8 +979,8 @@ if test "$with_openssl" = yes ; then
979979
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
980980
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
981981
else
982-
AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
983-
AC_SEARCH_LIBS(SSL_new, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
982+
AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
983+
AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
984984
fi
985985
AC_CHECK_FUNCS([SSL_get_current_compression])
986986
# Functions introduced in OpenSSL 1.1.0. We used to check for
@@ -1179,6 +1179,8 @@ fi
11791179

11801180
if test "$with_bonjour" = yes ; then
11811181
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
1182+
AC_SEARCH_LIBS(DNSServiceRefSockFD, dns_sd, [],
1183+
[AC_MSG_ERROR([could not find function 'DNSServiceRefSockFD' required for Bonjour])])
11821184
fi
11831185

11841186
# for contrib/uuid-ossp

0 commit comments

Comments
 (0)