From 7868dc7103b40484d177985bb04270250a50e262 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 19 Mar 2015 23:41:10 +0100 Subject: [PATCH] cyassl: detect the library as renamed wolfssl This change was made in CyaSSL/WolfSSL ver. 3.4.0 --- configure.ac | 60 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 0ef16f98517f27..5af07b90ea565f 100644 --- a/configure.ac +++ b/configure.ac @@ -1572,8 +1572,10 @@ if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then AC_CHECK_FUNCS( ENGINE_load_builtin_engines ) ]) - dnl these can only exist if openssl exists - dnl Cyassl doesn't have SSL_get_shutdown + dnl These can only exist if OpenSSL exists + dnl Older versions of Cyassl (some time before 2.9.4) don't have + dnl SSL_get_shutdown (but this check won't actually detect it there + dnl as it's a macro that needs the header files be included) dnl BoringSSL doesn't have DES_set_odd_parity AC_CHECK_FUNCS( RAND_status \ @@ -1940,6 +1942,10 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then OPT_CYASSL="" fi + dnl This should be reworked to use pkg-config instead + + cyassllibname=cyassl + if test -z "$OPT_CYASSL" ; then dnl check for lib in system default first @@ -1981,7 +1987,55 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then [ CPPFLAGS=$_cppflags LDFLAGS=$_ldflags + cyassllib="" + ]) + fi + + addld="" + addlib="" + addcflags="" + + if test "x$USE_CYASSL" != "xyes"; then + dnl libcyassl renamed to libwolfssl as of 3.4.0 + addld=-L$OPT_CYASSL/lib$libsuff + addcflags=-I$OPT_CYASSL/include + cyassllib=$OPT_CYASSL/lib$libsuff + + LDFLAGS="$LDFLAGS $addld" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + cyassllibname=wolfssl + my_ac_save_LIBS="$LIBS" + LIBS="-l$cyassllibname -lm $LIBS" + + AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +/* These aren't needed for detection and confuse WolfSSL. + They are set up properly later if it is detected. */ +#undef SIZEOF_LONG +#undef SIZEOF_LONG_LONG +#include + ]],[[ + return CyaSSL_Init(); + ]]) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled]) + AC_SUBST(USE_CYASSL, [1]) + CYASSL_ENABLED=1 + USE_CYASSL="yes" + curl_ssl_msg="enabled (CyaSSL)" + ], + [ + AC_MSG_RESULT(no) + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags + cyassllib="" ]) + LIBS="$my_ac_save_LIBS" fi if test "x$USE_CYASSL" = "xyes"; then @@ -1993,7 +2047,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h AC_CHECK_HEADERS(cyassl/error-ssl.h) - LIBS="-lcyassl -lm $LIBS" + LIBS="-l$cyassllibname -lm $LIBS" if test -n "$cyassllib"; then dnl when shared libs were found in a path that the run-time