110-cyassl-detect-the-library-as-renamed-wolfssl.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. From 7868dc7103b40484d177985bb04270250a50e262 Mon Sep 17 00:00:00 2001
  2. From: Dan Fandrich <dan@coneharvesters.com>
  3. Date: Thu, 19 Mar 2015 23:41:10 +0100
  4. Subject: [PATCH] cyassl: detect the library as renamed wolfssl
  5. This change was made in CyaSSL/WolfSSL ver. 3.4.0
  6. ---
  7. configure.ac | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
  8. 1 file changed, 57 insertions(+), 3 deletions(-)
  9. --- a/configure.ac
  10. +++ b/configure.ac
  11. @@ -1578,8 +1578,10 @@ if test "$curl_ssl_msg" = "$init_ssl_msg
  12. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  13. ])
  14. - dnl these can only exist if openssl exists
  15. - dnl yassl doesn't have SSL_get_shutdown
  16. + dnl These can only exist if OpenSSL exists
  17. + dnl Older versions of Cyassl (some time before 2.9.4) don't have
  18. + dnl SSL_get_shutdown (but this check won't actually detect it there
  19. + dnl as it's a macro that needs the header files be included)
  20. AC_CHECK_FUNCS( RAND_status \
  21. RAND_screen \
  22. @@ -1943,6 +1945,10 @@ if test "$curl_ssl_msg" = "$init_ssl_msg
  23. OPT_CYASSL=""
  24. fi
  25. + dnl This should be reworked to use pkg-config instead
  26. +
  27. + cyassllibname=cyassl
  28. +
  29. if test -z "$OPT_CYASSL" ; then
  30. dnl check for lib in system default first
  31. @@ -1984,7 +1990,55 @@ if test "$curl_ssl_msg" = "$init_ssl_msg
  32. [
  33. CPPFLAGS=$_cppflags
  34. LDFLAGS=$_ldflags
  35. + cyassllib=""
  36. + ])
  37. + fi
  38. +
  39. + addld=""
  40. + addlib=""
  41. + addcflags=""
  42. +
  43. + if test "x$USE_CYASSL" != "xyes"; then
  44. + dnl libcyassl renamed to libwolfssl as of 3.4.0
  45. + addld=-L$OPT_CYASSL/lib$libsuff
  46. + addcflags=-I$OPT_CYASSL/include
  47. + cyassllib=$OPT_CYASSL/lib$libsuff
  48. +
  49. + LDFLAGS="$LDFLAGS $addld"
  50. + if test "$addcflags" != "-I/usr/include"; then
  51. + CPPFLAGS="$CPPFLAGS $addcflags"
  52. + fi
  53. +
  54. + cyassllibname=wolfssl
  55. + my_ac_save_LIBS="$LIBS"
  56. + LIBS="-l$cyassllibname -lm $LIBS"
  57. +
  58. + AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
  59. + AC_LINK_IFELSE([
  60. + AC_LANG_PROGRAM([[
  61. +/* These aren't needed for detection and confuse WolfSSL.
  62. + They are set up properly later if it is detected. */
  63. +#undef SIZEOF_LONG
  64. +#undef SIZEOF_LONG_LONG
  65. +#include <cyassl/ssl.h>
  66. + ]],[[
  67. + return CyaSSL_Init();
  68. + ]])
  69. + ],[
  70. + AC_MSG_RESULT(yes)
  71. + AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  72. + AC_SUBST(USE_CYASSL, [1])
  73. + CYASSL_ENABLED=1
  74. + USE_CYASSL="yes"
  75. + curl_ssl_msg="enabled (CyaSSL)"
  76. + ],
  77. + [
  78. + AC_MSG_RESULT(no)
  79. + CPPFLAGS=$_cppflags
  80. + LDFLAGS=$_ldflags
  81. + cyassllib=""
  82. ])
  83. + LIBS="$my_ac_save_LIBS"
  84. fi
  85. if test "x$USE_CYASSL" = "xyes"; then
  86. @@ -1996,7 +2050,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg
  87. dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
  88. AC_CHECK_HEADERS(cyassl/error-ssl.h)
  89. - LIBS="-lcyassl -lm $LIBS"
  90. + LIBS="-l$cyassllibname -lm $LIBS"
  91. if test -n "$cyassllib"; then
  92. dnl when shared libs were found in a path that the run-time