Re #2185: Modified the autodetection in configure script to try to compile a sample code instead.

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@6018 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Sauw Ming 2019-05-31 05:03:21 +00:00
parent 2ba08831e3
commit 62fae52a43
2 changed files with 16 additions and 10 deletions

View File

@ -7955,22 +7955,24 @@ else
*darwin*) *darwin*)
SAVED_LIBS="$LIBS" SAVED_LIBS="$LIBS"
LIBS="-framework Security" LIBS="-framework Security"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <Security/SecureTransport.h>
int int
main () main ()
{ {
if (__builtin_available(macOS 10.3, iOS 11.3, *)) {
SSLContextRef ssl_ctx;
SSLReHandshake(ssl_ctx);
}
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
ac_ssl_backend=darwin ac_ssl_backend=darwin
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
conftest$ac_exeext conftest.$ac_ext
LIBS="$SAVED_LIBS" LIBS="$SAVED_LIBS"
if test "x$ac_ssl_backend" = "xdarwin"; then if test "x$ac_ssl_backend" = "xdarwin"; then
$as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h $as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h

View File

@ -1578,16 +1578,20 @@ AC_ARG_ENABLE(darwin-ssl,
*darwin*) *darwin*)
SAVED_LIBS="$LIBS" SAVED_LIBS="$LIBS"
LIBS="-framework Security" LIBS="-framework Security"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Security/SecureTransport.h>]],
[ac_ssl_backend=darwin],) [if (__builtin_available(macOS 10.12, iOS 10.0, *)) {
SSLContextRef ssl_ctx;
SSLReHandshake(ssl_ctx);
}])],
[ac_ssl_backend=darwin],)
LIBS="$SAVED_LIBS" LIBS="$SAVED_LIBS"
if test "x$ac_ssl_backend" = "xdarwin"; then if test "x$ac_ssl_backend" = "xdarwin"; then
AC_DEFINE(PJ_HAS_SSL_SOCK, 1) AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_DARWIN) AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_DARWIN)
LIBS="$LIBS -framework Security" LIBS="$LIBS -framework Security"
AC_MSG_RESULT([Checking if Security framework for Darwin SSL is available... yes]) AC_MSG_RESULT([Checking if Darwin SSL is available... yes])
else else
AC_MSG_RESULT([Checking if Security framework for Darwin SSL is available... no]) AC_MSG_RESULT([Checking if Darwin SSL is available... no])
fi fi
;; ;;
esac esac