No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

curl-openssl.m4 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. # License-Filename: COPYING
  22. # SPDX-License-Identifier: curl
  23. #
  24. #***************************************************************************
  25. # File version for 'aclocal' use. Keep it a single number.
  26. # serial 5
  27. dnl CURL_CHECK_OPENSSL_API_HEADERS
  28. dnl -------------------------------------------------
  29. dnl Find out OpenSSL headers API version, as reported
  30. dnl by OPENSSL_VERSION_NUMBER. No runtime checks
  31. dnl allowed here for cross-compilation support.
  32. dnl HAVE_OPENSSL_API_HEADERS is defined as apprpriate
  33. dnl only for systems which actually run the configure
  34. dnl script. Config files generated manually or in any
  35. dnl other way shall not define this.
  36. AC_DEFUN([CURL_CHECK_OPENSSL_API_HEADERS], [
  37. #
  38. tst_api="unknown"
  39. #
  40. AC_MSG_CHECKING([for OpenSSL headers version])
  41. CURL_CHECK_DEF([OPENSSL_VERSION_NUMBER], [
  42. # ifdef USE_OPENSSL
  43. # include <openssl/crypto.h>
  44. # else
  45. # include <crypto.h>
  46. # endif
  47. ], [silent])
  48. if test "$curl_cv_have_def_OPENSSL_VERSION_NUMBER" = "yes"; then
  49. tst_verlen=`expr "$curl_cv_def_OPENSSL_VERSION_NUMBER" : '.*'`
  50. case "x$tst_verlen" in
  51. x6)
  52. tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3`
  53. tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 4`
  54. tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5`
  55. tst_api=0x$tst_vermaj$tst_vermin$tst_verfix
  56. ;;
  57. x11|x10)
  58. tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3`
  59. tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5`
  60. tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 7`
  61. tst_api=0x$tst_vermaj$tst_vermin$tst_verfix
  62. ;;
  63. *)
  64. tst_api="unknown"
  65. ;;
  66. esac
  67. case $tst_api in
  68. 0x110) tst_show="1.1.0" ;;
  69. 0x102) tst_show="1.0.2" ;;
  70. 0x101) tst_show="1.0.1" ;;
  71. 0x100) tst_show="1.0.0" ;;
  72. 0x099) tst_show="0.9.9" ;;
  73. 0x098) tst_show="0.9.8" ;;
  74. 0x097) tst_show="0.9.7" ;;
  75. 0x096) tst_show="0.9.6" ;;
  76. 0x095) tst_show="0.9.5" ;;
  77. 0x094) tst_show="0.9.4" ;;
  78. 0x093) tst_show="0.9.3" ;;
  79. 0x092) tst_show="0.9.2" ;;
  80. 0x091) tst_show="0.9.1" ;;
  81. *) tst_show="unknown" ;;
  82. esac
  83. tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER"
  84. else
  85. tst_show="unknown"
  86. fi
  87. AC_MSG_RESULT([$tst_show])
  88. #
  89. dnl if test "$tst_api" != "unknown"; then
  90. dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_HEADERS, $tst_api,
  91. dnl [OpenSSL headers configure time API. Defined only by configure script.
  92. dnl No matter what, do not ever define this manually or by any other means.])
  93. dnl fi
  94. curl_openssl_api_headers=$tst_api
  95. ])
  96. dnl CURL_CHECK_OPENSSL_API_LIBRARY
  97. dnl -------------------------------------------------
  98. dnl Find out OpenSSL library API version, performing
  99. dnl only link tests in order to avoid getting fooled
  100. dnl by mismatched OpenSSL headers. No runtime checks
  101. dnl allowed here for cross-compilation support.
  102. dnl HAVE_OPENSSL_API_LIBRARY is defined as apprpriate
  103. dnl only for systems which actually run the configure
  104. dnl script. Config files generated manually or in any
  105. dnl other way shall not define this.
  106. dnl
  107. dnl Most probably we should not bother attempting to
  108. dnl detect OpenSSL library development API versions
  109. dnl 0.9.9 and 1.1.0. For our intended use, detecting
  110. dnl released versions should be good enough.
  111. dnl
  112. dnl Given that currently we are not using the result
  113. dnl of this check, except for informative purposes,
  114. dnl lets try to figure out everything.
  115. AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [
  116. #
  117. tst_api="unknown"
  118. #
  119. AC_MSG_CHECKING([for OpenSSL library version])
  120. if test "$tst_api" = "unknown"; then
  121. case $host in
  122. *-*-vms*)
  123. AC_LINK_IFELSE([
  124. AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumbl_sess_cb])
  125. ],[
  126. tst_api="0x110"
  127. ])
  128. ;;
  129. *)
  130. AC_LINK_IFELSE([
  131. AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumable_session_callback])
  132. ],[
  133. tst_api="0x110"
  134. ])
  135. ;;
  136. esac
  137. fi
  138. if test "$tst_api" = "unknown"; then
  139. AC_LINK_IFELSE([
  140. AC_LANG_FUNC_LINK_TRY([SSL_CONF_CTX_new])
  141. ],[
  142. tst_api="0x102"
  143. ])
  144. fi
  145. if test "$tst_api" = "unknown"; then
  146. AC_LINK_IFELSE([
  147. AC_LANG_FUNC_LINK_TRY([SSL_renegotiate_abbreviated])
  148. ],[
  149. tst_api="0x101"
  150. ])
  151. fi
  152. if test "$tst_api" = "unknown"; then
  153. AC_LINK_IFELSE([
  154. AC_LANG_FUNC_LINK_TRY([OBJ_add_sigid])
  155. ],[
  156. tst_api="0x100"
  157. ])
  158. fi
  159. if test "$tst_api" = "unknown"; then
  160. AC_LINK_IFELSE([
  161. AC_LANG_FUNC_LINK_TRY([ERR_set_mark])
  162. ],[
  163. tst_api="0x098"
  164. ])
  165. fi
  166. if test "$tst_api" = "unknown"; then
  167. AC_LINK_IFELSE([
  168. AC_LANG_FUNC_LINK_TRY([ERR_peek_last_error])
  169. ],[
  170. tst_api="0x097"
  171. ])
  172. fi
  173. if test "$tst_api" = "unknown"; then
  174. AC_LINK_IFELSE([
  175. AC_LANG_FUNC_LINK_TRY([c2i_ASN1_OBJECT])
  176. ],[
  177. tst_api="0x096"
  178. ])
  179. fi
  180. if test "$tst_api" = "unknown"; then
  181. AC_LINK_IFELSE([
  182. AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_purpose])
  183. ],[
  184. tst_api="0x095"
  185. ])
  186. fi
  187. if test "$tst_api" = "unknown"; then
  188. AC_LINK_IFELSE([
  189. AC_LANG_FUNC_LINK_TRY([OBJ_obj2txt])
  190. ],[
  191. tst_api="0x094"
  192. ])
  193. fi
  194. if test "$tst_api" = "unknown"; then
  195. AC_LINK_IFELSE([
  196. AC_LANG_FUNC_LINK_TRY([SSL_get_verify_depth])
  197. ],[
  198. tst_api="0x093"
  199. ])
  200. fi
  201. if test "$tst_api" = "unknown"; then
  202. AC_LINK_IFELSE([
  203. AC_LANG_FUNC_LINK_TRY([SSL_library_init])
  204. ],[
  205. tst_api="0x092"
  206. ])
  207. fi
  208. if test "$tst_api" = "unknown"; then
  209. AC_LINK_IFELSE([
  210. AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_cipher_list])
  211. ],[
  212. tst_api="0x091"
  213. ])
  214. fi
  215. case $tst_api in
  216. 0x110) tst_show="1.1.0" ;;
  217. 0x102) tst_show="1.0.2" ;;
  218. 0x101) tst_show="1.0.1" ;;
  219. 0x100) tst_show="1.0.0" ;;
  220. 0x099) tst_show="0.9.9" ;;
  221. 0x098) tst_show="0.9.8" ;;
  222. 0x097) tst_show="0.9.7" ;;
  223. 0x096) tst_show="0.9.6" ;;
  224. 0x095) tst_show="0.9.5" ;;
  225. 0x094) tst_show="0.9.4" ;;
  226. 0x093) tst_show="0.9.3" ;;
  227. 0x092) tst_show="0.9.2" ;;
  228. 0x091) tst_show="0.9.1" ;;
  229. *) tst_show="unknown" ;;
  230. esac
  231. AC_MSG_RESULT([$tst_show])
  232. #
  233. dnl if test "$tst_api" != "unknown"; then
  234. dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_LIBRARY, $tst_api,
  235. dnl [OpenSSL library link time API. Defined only by configure script.
  236. dnl No matter what, do not ever define this manually or by any other means.])
  237. dnl fi
  238. curl_openssl_api_library=$tst_api
  239. ])
  240. dnl CURL_CHECK_OPENSSL_API
  241. dnl -------------------------------------------------
  242. AC_DEFUN([CURL_CHECK_OPENSSL_API], [
  243. #
  244. CURL_CHECK_OPENSSL_API_HEADERS
  245. CURL_CHECK_OPENSSL_API_LIBRARY
  246. #
  247. tst_match="yes"
  248. #
  249. AC_MSG_CHECKING([for OpenSSL headers and library versions matching])
  250. if test "$curl_openssl_api_headers" = "unknown" ||
  251. test "$curl_openssl_api_library" = "unknown"; then
  252. tst_match="fail"
  253. tst_warns="Can not compare OpenSSL headers and library versions."
  254. elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then
  255. tst_match="no"
  256. tst_warns="OpenSSL headers and library versions do not match."
  257. fi
  258. AC_MSG_RESULT([$tst_match])
  259. if test "$tst_match" != "yes"; then
  260. AC_MSG_WARN([$tst_warns])
  261. fi
  262. ])