Skip to content

Commit 58bc9ea

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 6c05b81 commit 58bc9ea

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
@@ -11178,6 +11178,64 @@ else
1117811178
fi
1117911179

1118011180

11181+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing DNSServiceRefSockFD" >&5
11182+
$as_echo_n "checking for library containing DNSServiceRefSockFD... " >&6; }
11183+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
11184+
$as_echo_n "(cached) " >&6
11185+
else
11186+
ac_func_search_save_LIBS=$LIBS
11187+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11188+
/* end confdefs.h. */
11189+
11190+
/* Override any GCC internal prototype to avoid an error.
11191+
Use char because int might match the return type of a GCC
11192+
builtin and then its argument prototype would still apply. */
11193+
#ifdef __cplusplus
11194+
extern "C"
11195+
#endif
11196+
char DNSServiceRefSockFD ();
11197+
int
11198+
main ()
11199+
{
11200+
return DNSServiceRefSockFD ();
11201+
;
11202+
return 0;
11203+
}
11204+
_ACEOF
11205+
for ac_lib in '' dns_sd; do
11206+
if test -z "$ac_lib"; then
11207+
ac_res="none required"
11208+
else
11209+
ac_res=-l$ac_lib
11210+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
11211+
fi
11212+
if ac_fn_c_try_link "$LINENO"; then :
11213+
ac_cv_search_DNSServiceRefSockFD=$ac_res
11214+
fi
11215+
rm -f core conftest.err conftest.$ac_objext \
11216+
conftest$ac_exeext
11217+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
11218+
break
11219+
fi
11220+
done
11221+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
11222+
11223+
else
11224+
ac_cv_search_DNSServiceRefSockFD=no
11225+
fi
11226+
rm conftest.$ac_ext
11227+
LIBS=$ac_func_search_save_LIBS
11228+
fi
11229+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_DNSServiceRefSockFD" >&5
11230+
$as_echo "$ac_cv_search_DNSServiceRefSockFD" >&6; }
11231+
ac_res=$ac_cv_search_DNSServiceRefSockFD
11232+
if test "$ac_res" != no; then :
11233+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
11234+
11235+
else
11236+
as_fn_error $? "could not find function 'DNSServiceRefSockFD' required for Bonjour" "$LINENO" 5
11237+
fi
11238+
1118111239
fi
1118211240

1118311241
# for contrib/uuid-ossp

configure.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,8 @@ if test "$with_openssl" = yes ; then
10921092
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
10931093
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
10941094
else
1095-
AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
1096-
AC_SEARCH_LIBS(SSL_new, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
1095+
AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
1096+
AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
10971097
fi
10981098
AC_CHECK_FUNCS([SSL_get_current_compression])
10991099
# Functions introduced in OpenSSL 1.1.0. We used to check for
@@ -1293,6 +1293,8 @@ fi
12931293

12941294
if test "$with_bonjour" = yes ; then
12951295
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
1296+
AC_SEARCH_LIBS(DNSServiceRefSockFD, dns_sd, [],
1297+
[AC_MSG_ERROR([could not find function 'DNSServiceRefSockFD' required for Bonjour])])
12961298
fi
12971299

12981300
# for contrib/uuid-ossp

0 commit comments

Comments
 (0)