Skip to content

Commit 9042e92

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 13492fc commit 9042e92

File tree

2 files changed

+95
-2
lines changed

2 files changed

+95
-2
lines changed

configure

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14775,6 +14775,97 @@ $as_echo "$as_me: error: header file <dns_sd.h> is required for Bonjour" >&2;}
1477514775
fi
1477614776

1477714777

14778+
{ $as_echo "$as_me:$LINENO: checking for library containing DNSServiceRefSockFD" >&5
14779+
$as_echo_n "checking for library containing DNSServiceRefSockFD... " >&6; }
14780+
if test "${ac_cv_search_DNSServiceRefSockFD+set}" = set; then
14781+
$as_echo_n "(cached) " >&6
14782+
else
14783+
ac_func_search_save_LIBS=$LIBS
14784+
cat >conftest.$ac_ext <<_ACEOF
14785+
/* confdefs.h. */
14786+
_ACEOF
14787+
cat confdefs.h >>conftest.$ac_ext
14788+
cat >>conftest.$ac_ext <<_ACEOF
14789+
/* end confdefs.h. */
14790+
14791+
/* Override any GCC internal prototype to avoid an error.
14792+
Use char because int might match the return type of a GCC
14793+
builtin and then its argument prototype would still apply. */
14794+
#ifdef __cplusplus
14795+
extern "C"
14796+
#endif
14797+
char DNSServiceRefSockFD ();
14798+
int
14799+
main ()
14800+
{
14801+
return DNSServiceRefSockFD ();
14802+
;
14803+
return 0;
14804+
}
14805+
_ACEOF
14806+
for ac_lib in '' dns_sd; do
14807+
if test -z "$ac_lib"; then
14808+
ac_res="none required"
14809+
else
14810+
ac_res=-l$ac_lib
14811+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
14812+
fi
14813+
rm -f conftest.$ac_objext conftest$ac_exeext
14814+
if { (ac_try="$ac_link"
14815+
case "(($ac_try" in
14816+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14817+
*) ac_try_echo=$ac_try;;
14818+
esac
14819+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
14820+
$as_echo "$ac_try_echo") >&5
14821+
(eval "$ac_link") 2>conftest.er1
14822+
ac_status=$?
14823+
grep -v '^ *+' conftest.er1 >conftest.err
14824+
rm -f conftest.er1
14825+
cat conftest.err >&5
14826+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
14827+
(exit $ac_status); } && {
14828+
test -z "$ac_c_werror_flag" ||
14829+
test ! -s conftest.err
14830+
} && test -s conftest$ac_exeext && {
14831+
test "$cross_compiling" = yes ||
14832+
$as_test_x conftest$ac_exeext
14833+
}; then
14834+
ac_cv_search_DNSServiceRefSockFD=$ac_res
14835+
else
14836+
$as_echo "$as_me: failed program was:" >&5
14837+
sed 's/^/| /' conftest.$ac_ext >&5
14838+
14839+
14840+
fi
14841+
14842+
rm -rf conftest.dSYM
14843+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
14844+
conftest$ac_exeext
14845+
if test "${ac_cv_search_DNSServiceRefSockFD+set}" = set; then
14846+
break
14847+
fi
14848+
done
14849+
if test "${ac_cv_search_DNSServiceRefSockFD+set}" = set; then
14850+
:
14851+
else
14852+
ac_cv_search_DNSServiceRefSockFD=no
14853+
fi
14854+
rm conftest.$ac_ext
14855+
LIBS=$ac_func_search_save_LIBS
14856+
fi
14857+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_DNSServiceRefSockFD" >&5
14858+
$as_echo "$ac_cv_search_DNSServiceRefSockFD" >&6; }
14859+
ac_res=$ac_cv_search_DNSServiceRefSockFD
14860+
if test "$ac_res" != no; then
14861+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
14862+
14863+
else
14864+
{ { $as_echo "$as_me:$LINENO: error: could not find function 'DNSServiceRefSockFD' required for Bonjour" >&5
14865+
$as_echo "$as_me: error: could not find function 'DNSServiceRefSockFD' required for Bonjour" >&2;}
14866+
{ (exit 1); exit 1; }; }
14867+
fi
14868+
1477814869
fi
1477914870

1478014871
# for contrib/uuid-ossp

configure.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,8 +954,8 @@ if test "$with_openssl" = yes ; then
954954
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
955955
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
956956
else
957-
AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
958-
AC_SEARCH_LIBS(SSL_new, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
957+
AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
958+
AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
959959
fi
960960
# Functions introduced in OpenSSL 1.1.0. We used to check for
961961
# OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
@@ -1145,6 +1145,8 @@ fi
11451145

11461146
if test "$with_bonjour" = yes ; then
11471147
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
1148+
AC_SEARCH_LIBS(DNSServiceRefSockFD, dns_sd, [],
1149+
[AC_MSG_ERROR([could not find function 'DNSServiceRefSockFD' required for Bonjour])])
11481150
fi
11491151

11501152
# for contrib/uuid-ossp

0 commit comments

Comments
 (0)