8000 Allow --with-bonjour to work with non-macOS implementations of Bonjour. · koderP/postgres@0e9294a · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 0e9294a

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 d7f5934 commit 0e9294a

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
@@ -9848,6 +9848,64 @@ else
98489848
fi
98499849

98509850

9851+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing DNSServiceRefSockFD" >&5
9852+
$as_echo_n "checking for library containing DNSServiceRefSockFD... " >&6; }
9853+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
9854+
$as_echo_n "(cached) " >&6
9855+
else
9856+
ac_func_search_save_LIBS=$LIBS
9857+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9858+
/* end confdefs.h. */
9859+
9860+
/* Override any GCC internal prototype to avoid an error.
9861+
Use char because int might match the return type of a GCC
9862+
builtin and then its argument prototype would still apply. */
9863+
#ifdef __cplusplus
9864+
extern "C"
9865+
#endif
9866+
char DNSServiceRefSockFD ();
9867+
int
9868+
main ()
9869+
{
9870+
return DNSServiceRefSockFD ();
9871+
;
9872+
return 0;
9873+
}
9874+
_ACEOF
9875+
for ac_lib in '' dns_sd; do
9876+
if test -z "$ac_lib"; then
9877+
ac_res="none required"
9878+
else
9879+
ac_res=-l$ac_lib
9880+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9881+
fi
9882+
if ac_fn_c_try_link "$LINENO"; then :
9883+
ac_cv_search_DNSServiceRefSockFD=$ac_res
9884+
fi
9885+
rm -f core conftest.err conftest.$ac_objext \
9886+
conftest$ac_exeext
9887+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
9888+
break
9889+
fi
9890+
done
9891+
if ${ac_cv_search_DNSServiceRefSockFD+:} false; then :
9892+
9893+
else
9894+
ac_cv_search_DNSServiceRefSockFD=no
9895+
fi
9896+
rm conftest.$ac_ext
9897+
LIBS=$ac_func_search_save_LIBS
9898+
fi
9899+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_DNSServiceRefSockFD" >&5
9900+
$as_echo "$ac_cv_search_DNSServiceRefSockFD" >&6; }
9901+
ac_res=$ac_cv_search_DNSServiceRefSockFD
9902+
if test "$ac_res" != no; then :
9903+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9904+
9905+
else
9906+
as_fn_error $? "could not find function 'DNSServiceRefSockFD' required for Bonjour" "$LINENO" 5
9907+
fi
9908+
98519909
fi
98529910

98539911
# for contrib/uuid-ossp

configure.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,8 +1031,8 @@ if test "$with_openssl" = yes ; then
10311031
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
10321032
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
10331033
else
1034-
AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
1035-
AC_SEARCH_LIBS(SSL_new, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
1034+
AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
1035+
AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
10361036
fi
10371037
AC_CHECK_FUNCS([SSL_get_current_compression])
10381038
# Functions introduced in OpenSSL 1.1.0. We used to check for
@@ -1203,6 +1203,8 @@ fi
12031203

12041204
if test "$with_bonjour" = yes ; then
12051205
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
1206+
AC_SEARCH_LIBS(DNSServiceRefSockFD, dns_sd, [],
1207+
[AC_MSG_ERROR([could not find function 'DNSServiceRefSockFD' required for Bonjour])])
12061208
fi
12071209

12081210
# for contrib/uuid-ossp

0 commit comments

Comments
 (0)
0